org.hibernate.mapping.Property.getName()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.hibernate.mapping.Property.getName()方法的一些代码示例,展示了Property.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.getName()方法的具体详情如下:
包路径:org.hibernate.mapping.Property
类名称:Property
方法名:getName

Property.getName介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

public void addDeclaredProperty(Property p) {
  //Do not add duplicate properties
  //TODO is it efficient enough?
  String name = p.getName();
  Iterator it = declaredProperties.iterator();
  while (it.hasNext()) {
    if ( name.equals( ((Property)it.next()).getName() ) ) {
      return;
    }
  }
  declaredProperties.add(p);
}

代码示例来源:origin: hibernate/hibernate-orm

private PropertyData getIdPropertyData(Property property) {
  return new PropertyData(
      property.getName(), property.getName(), property.getPropertyAccessorName(),
      ModificationStore.FULL
  );
}

代码示例来源:origin: hibernate/hibernate-orm

private void addPersistentProperty(Property property) {
  if ( "field".equals( property.getPropertyAccessorName() ) ) {
    fieldAccessedPersistentProperties.add( property.getName() );
  }
  else {
    propertyAccessedPersistentProperties.put( property.getName(), property.getPropertyAccessorName() );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@SuppressWarnings("unchecked")
private void createPropertiesGroupMapping(Property property) {
  final Component component = (Component) property.getValue();
  final Iterator<Property> componentProperties = component.getPropertyIterator();
  while ( componentProperties.hasNext() ) {
    final Property componentProperty = componentProperties.next();
    propertiesGroupMapping.put( componentProperty.getName(), property.getName() );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private boolean checkPropertiesAudited(Iterator<Property> properties, ClassAuditingData auditingData) {
  while ( properties.hasNext() ) {
    final Property property = properties.next();
    final String propertyName = property.getName();
    final PropertyAuditingData propertyAuditingData = auditingData.getPropertyAuditingData( propertyName );
    if ( propertyAuditingData == null ) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: hibernate/hibernate-orm

private void checkPropertyDuplication() throws MappingException {
  HashSet<String> names = new HashSet<>();
  Iterator iter = getPropertyIterator();
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    if ( !names.add( prop.getName() ) ) {
      throw new MappingException( "Duplicate property mapping of " + prop.getName() + " found in " + getEntityName() );
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

public Property getProperty(String propertyName) throws MappingException {
  Iterator iter = getPropertyIterator();
  while ( iter.hasNext() ) {
    Property prop = (Property) iter.next();
    if ( prop.getName().equals(propertyName) ) {
      return prop;
    }
  }
  throw new MappingException("component property not found: " + propertyName);
}

代码示例来源:origin: hibernate/hibernate-orm

private Property getProperty(String propertyName, Iterator iterator) throws MappingException {
  if ( iterator.hasNext() ) {
    String root = StringHelper.root( propertyName );
    while ( iterator.hasNext() ) {
      Property prop = (Property) iterator.next();
      if ( prop.getName().equals( root ) ) {
        return prop;
      }
    }
  }
  throw new MappingException( "property [" + propertyName + "] not found on entity [" + getEntityName() + "]" );
}

代码示例来源:origin: hibernate/hibernate-orm

private PropertyAuditingData getIdPersistentPropertyAuditingData(Property property) {
  return new PropertyAuditingData(
      property.getName(), property.getPropertyAccessorName(),
      ModificationStore.FULL, RelationTargetAuditMode.AUDITED, null, null, false
  );
}

代码示例来源:origin: hibernate/hibernate-orm

private void readPersistentPropertiesAccess() {
  final Iterator<Property> propertyIter = persistentPropertiesSource.getPropertyIterator();
  while ( propertyIter.hasNext() ) {
    final Property property = propertyIter.next();
    addPersistentProperty( property );
    // See HHH-6636
    if ( "embedded".equals( property.getPropertyAccessorName() ) && !PropertyPath.IDENTIFIER_MAPPER_PROPERTY.equals( property.getName() ) ) {
      createPropertiesGroupMapping( property );
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

private PropertyAccess buildPropertyAccess(Property mappedProperty) {
  if ( mappedProperty.isBackRef() ) {
    return mappedProperty.getPropertyAccessStrategy( null ).buildPropertyAccess( null, mappedProperty.getName() );
  }
  else {
    return PropertyAccessStrategyMapImpl.INSTANCE.buildPropertyAccess( null, mappedProperty.getName() );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

protected Setter buildSetter(Component component, Property prop) {
  return PropertyAccessStrategyMapImpl.INSTANCE.buildPropertyAccess( null, prop.getName() ).getSetter();
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public String getIdentifierPropertyName(String entityName) throws MappingException {
  final PersistentClass pc = entityBindingMap.get( entityName );
  if ( pc == null ) {
    throw new MappingException( "persistent class not known: " + entityName );
  }
  if ( !pc.hasIdentifierProperty() ) {
    return null;
  }
  return pc.getIdentifierProperty().getName();
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public String getIdentifierPropertyName(String entityName) throws MappingException {
  final PersistentClass pc = entityBindingMap.get( entityName );
  if ( pc == null ) {
    throw new MappingException( "persistent class not known: " + entityName );
  }
  if ( !pc.hasIdentifierProperty() ) {
    return null;
  }
  return pc.getIdentifierProperty().getName();
}

代码示例来源:origin: hibernate/hibernate-orm

private Setter injector(Property property, Class attributeDeclarer) {
  return property.getPropertyAccessStrategy( attributeDeclarer )
      .buildPropertyAccess( attributeDeclarer, property.getName() )
      .getSetter();
}

代码示例来源:origin: hibernate/hibernate-orm

public static Set<String> extractModProperties(PersistentClass persistentClass, String suffix) {
  final Set<String> result = new HashSet<String>();
  final Iterator iterator = persistentClass.getPropertyIterator();
  while ( iterator.hasNext() ) {
    final Property property = (Property) iterator.next();
    final String propertyName = property.getName();
    if ( propertyName.endsWith( suffix ) ) {
      result.add( propertyName );
    }
  }
  return result;
}

代码示例来源:origin: hibernate/hibernate-orm

public Property getProperty(String propertyName) throws MappingException {
  Iterator iter = getPropertyClosureIterator();
  Property identifierProperty = getIdentifierProperty();
  if ( identifierProperty != null
      && identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) {
    return identifierProperty;
  }
  else {
    return getProperty( propertyName, iter );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Test
  public void testMapping() {
    PersistentClass pc = metadata().getEntityBinding( UnversionedOptimisticLockingFieldEntity.class.getName() + "_AUD" );
    Iterator pi = pc.getPropertyIterator();
    while ( pi.hasNext() ) {
      Property p = (Property) pi.next();
      assert !"optLocking".equals( p.getName() );
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

protected AbstractPluralAttribute(PluralAttributeBuilder<D,C,E,?> builder) {
  super(
      builder.getDeclaringType(),
      builder.getProperty().getName(),
      builder.getAttributeNature(),
      builder.getValueType(),
      builder.getMember()
  );
  this.collectionClass = builder.getCollectionClass();
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
  public Member resolveMember(AttributeContext attributeContext) {
    final EmbeddedTypeDescriptor embeddableType = (EmbeddedTypeDescriptor<?>) attributeContext.getOwnerType();
    final String attributeName = attributeContext.getPropertyMapping().getName();
    final Getter getter = embeddableType.getHibernateType()
        .getComponentTuplizer()
        .getGetter( embeddableType.getHibernateType().getPropertyIndex( attributeName ) );
    return PropertyAccessMapImpl.GetterImpl.class.isInstance( getter )
        ? new MapMember( attributeName, attributeContext.getPropertyMapping().getType().getReturnedClass() )
        : getter.getMember();
  }
};

相关文章

微信公众号

最新文章

更多