org.hibernate.property.Getter.get()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(115)

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

Getter.get介绍

[英]Get the property value from the given instance .
[中]从给定实例获取属性值。

代码示例

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

public Object getPropertyValue(Object component, int i)
throws HibernateException {
  return getters[i].get( component );
}

代码示例来源:origin: sk.seges.corpis/corpis-dao-impl

@Override
  protected Object executeForIntermediateField(String field, Object result)
      throws InstantiationException, IllegalAccessException {
    // set intermediate object association
    Getter getter = propertyAccessor.getGetter(result.getClass(), field);
    Setter setter = propertyAccessor.getSetter(result.getClass(), field);
    Object associate = getter.get(result);
    if (associate == null) {
      // there is no instance yet in referenced field
      associate = getter.getReturnType().newInstance();
    }
    setter.set(result, associate, null);
    return associate;
  }
}.resolve(alias, i);

代码示例来源:origin: org.nakedobjects.plugins/hibernate-hibernate

@Ignore("need to convert, was originally written for the old value holder design (TextString, etc)")
@Test
public void testGetter() {
  obj.setString(expected);
  NakedPropertyAccessor accessor = new NakedPropertyAccessor();
  Getter getter = accessor.getGetter(SimpleObject.class, "string");
  assertEquals("string", expected, getter.get(obj));
  assertEquals("string", expected, getter.getForInsert(obj, null, null));
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Object getParent(Object component) {
  return parentGetter.get( component );
}

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

public Query setProperties(Object bean) throws HibernateException {
  Class clazz = bean.getClass();
  String[] params = getNamedParameters();
  for (int i = 0; i < params.length; i++) {
    String namedParam = params[i];
    try {
      Getter getter = ReflectHelper.getGetter(clazz, namedParam);
      Class retType = getter.getReturnType();
      final Object object = getter.get( bean );
      if ( Collection.class.isAssignableFrom(retType) ) {
        setParameterList( namedParam, (Collection) object );
      }
      else if ( retType.isArray() ) {
         setParameterList( namedParam, (Object[]) object );
      }
      else {
        setParameter( namedParam, object, guessType( getter.getReturnType() ) );
      }
    }
    catch (PropertyNotFoundException pnfe) {}
  }
  return this;
}

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

public Object getPropertyValue(Object entity, int i) throws HibernateException {
  return getters[i].get( entity );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Query setProperties(Object bean) throws HibernateException {
  Class clazz = bean.getClass();
  String[] params = getNamedParameters();
  for (int i = 0; i < params.length; i++) {
    String namedParam = params[i];
    try {
      Getter getter = ReflectHelper.getGetter( clazz, namedParam );
      Class retType = getter.getReturnType();
      final Object object = getter.get( bean );
      if ( Collection.class.isAssignableFrom( retType ) ) {
        setParameterList( namedParam, ( Collection ) object );
      }
      else if ( retType.isArray() ) {
         setParameterList( namedParam, ( Object[] ) object );
      }
      else {
        setParameter( namedParam, object, determineType( namedParam, retType ) );
      }
    }
    catch (PropertyNotFoundException pnfe) {
      // ignore
    }
  }
  return this;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Object getParent(Object component) {
  return parentGetter.get( component );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Object getPropertyValue(Object component, int i) throws HibernateException {
  return getters[i].get( component );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Object getPropertyValue(Object component, int i) throws HibernateException {
  return getters[i].get( component );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Object getPropertyValue(Object entity, int i) throws HibernateException {
  return getters[i].get( entity );
}

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

public Object getParent(Object component) {
  return parentGetter.get( component );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Object getPropertyValue(Object entity, int i) throws HibernateException {
  return getters[i].get( entity );
}

代码示例来源:origin: org.hibernate/hibernate-validator-legacy

@SuppressWarnings( "unchecked" )
private void validateSubElements(
    ValidatableElement element, Object entity, List<InvalidValue> consolidatedInvalidValues
) {
  if ( element != null ) {
    for ( ValidatableElement subElement : element.subElements ) {
      Object component = subElement.getter.get( entity );
      InvalidValue[] invalidValues = subElement.validator.getInvalidValues( component );
      for ( InvalidValue invalidValue : invalidValues ) {
        consolidatedInvalidValues.add( invalidValue );
      }
      validateSubElements( subElement, component, consolidatedInvalidValues );
    }
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Object getVersion(Object entity) throws HibernateException {
  if ( !entityMetamodel.isVersioned() ) return null;
  return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity );
}

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

public Object getVersion(Object entity) throws HibernateException {
  if ( !entityMetamodel.isVersioned() ) return null;
  return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Object getVersion(Object entity) throws HibernateException {
  if ( !entityMetamodel.isVersioned() ) return null;
  return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity );
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

public Object[] getPropertyValues(Object entity) throws HibernateException {
  boolean getAll = shouldGetAllProperties( entity );
  final int span = entityMetamodel.getPropertySpan();
  final Object[] result = new Object[span];
  for ( int j = 0; j < span; j++ ) {
    StandardProperty property = entityMetamodel.getProperties()[j];
    if ( getAll || !property.isLazy() ) {
      result[j] = getters[j].get( entity );
    }
    else {
      result[j] = LazyPropertyInitializer.UNFETCHED_PROPERTY;
    }
  }
  return result;
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Object[] getPropertyValues(Object entity) throws HibernateException {
  boolean getAll = shouldGetAllProperties( entity );
  final int span = entityMetamodel.getPropertySpan();
  final Object[] result = new Object[span];
  for ( int j = 0; j < span; j++ ) {
    StandardProperty property = entityMetamodel.getProperties()[j];
    if ( getAll || !property.isLazy() ) {
      result[j] = getters[j].get( entity );
    }
    else {
      result[j] = LazyPropertyInitializer.UNFETCHED_PROPERTY;
    }
  }
  return result;
}

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

public Object[] getPropertyValues(Object entity) throws HibernateException {
  boolean getAll = shouldGetAllProperties( entity );
  final int span = entityMetamodel.getPropertySpan();
  final Object[] result = new Object[span];
  for ( int j = 0; j < span; j++ ) {
    StandardProperty property = entityMetamodel.getProperties()[j];
    if ( getAll || !property.isLazy() ) {
      result[j] = getters[j].get( entity );
    }
    else {
      result[j] = LazyPropertyInitializer.UNFETCHED_PROPERTY;
    }
  }
  return result;
}

相关文章