public HibernateEntityValueEncoder(Class<E> entityClass, String identifierPropertyName, Session session, PropertyAccess propertyAccess, TypeCoercer typeCoercer, Logger logger) { this.entityClass = entityClass; this.session = session; this.typeCoercer = typeCoercer; this.logger = logger; propertyAdapter = propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(identifierPropertyName); }
for (String name : adapter.getPropertyNames()) Object value = adapter.getPropertyAdapter(name).get(current);
@Override public Object get(Object instance, String propertyName) { return getAdapter(instance).get(instance, propertyName); }
public ExceptionAnalyzerImpl(PropertyAccess propertyAccess) { this.propertyAccess = propertyAccess; throwableProperties = CollectionFactory.newSet(this.propertyAccess.getAdapter(Throwable.class) .getPropertyNames()); }
@Override public Annotation getAnnotation(Object instance, String propertyName, Class<? extends Annotation> annotationClass) { return getAdapter(instance).getAnnotation(instance, propertyName, annotationClass); }
public ExceptionAnalyzerImpl(PropertyAccess propertyAccess) { this.propertyAccess = propertyAccess; throwableProperties = CollectionFactory.newSet(this.propertyAccess.getAdapter(Throwable.class) .getPropertyNames()); }
public HibernateEntityValueEncoder(Class<E> entityClass, String identifierPropertyName, Session session, PropertyAccess propertyAccess, TypeCoercer typeCoercer, Logger logger) { this.entityClass = entityClass; this.session = session; this.typeCoercer = typeCoercer; this.logger = logger; propertyAdapter = propertyAccess.getAdapter(this.entityClass).getPropertyAdapter(identifierPropertyName); }
public PropertyAdapter findPropertyAdapter(Type activeType, String propertyName) { Class activeClass = GenericsUtils.asClass(activeType); ClassPropertyAdapter classAdapter = access.getAdapter(activeClass); PropertyAdapter adapter = classAdapter.getPropertyAdapter(propertyName); if (adapter == null) { final List<String> names = classAdapter.getPropertyNames(); final String className = activeClass.getName(); throw new UnknownValueException(String.format( "Class %s does not contain a property (or public field) named '%s'.", className, propertyName), new AvailableValues("Properties (and public fields)", names)); } return adapter; }
/** * @param classAdapter defines the bean that contains the properties * @param propertyNames the initial set of property names, which will be rebuilt in the correct order */ private void orderProperties(ClassPropertyAdapter classAdapter, List<String> propertyNames) { List<PropertyOrder> properties = CollectionFactory.newList(); for (String name : propertyNames) { PropertyAdapter pa = classAdapter.getPropertyAdapter(name); Method readMethod = pa.getReadMethod(); Location location = readMethod == null ? null : proxyFactory.getMethodLocation(readMethod); int line = location == null ? -1 : location.getLine(); properties.add(new PropertyOrder(name, computeDepth(pa), line)); } Collections.sort(properties); propertyNames.clear(); for (PropertyOrder po : properties) { propertyNames.add(po.propertyName); } }
for (String name : adapter.getPropertyNames()) PropertyAdapter pa = adapter.getPropertyAdapter(name);
protected final void train_getPropertyAdapter(ClassPropertyAdapter classPropertyAdapter, String propertyName, PropertyAdapter propertyAdapter) { expect(classPropertyAdapter.getPropertyAdapter(propertyName)).andReturn(propertyAdapter).atLeastOnce(); }
for (String name : adapter.getPropertyNames()) PropertyAdapter pa = adapter.getPropertyAdapter(name);
final PropertyAdapter adapter = propertyAccess.getAdapter(sourceClass).getPropertyAdapter(propertyName);
for (final String propertyName : adapter.getPropertyNames()) PropertyAdapter pa = adapter.getPropertyAdapter(propertyName);
final PropertyAdapter adapter = propertyAccess.getAdapter(sourceClass).getPropertyAdapter(propertyName);
@SuppressWarnings({ "unchecked", "rawtypes" }) public String getLabel(Object object) { final ClassPropertyAdapter classPropertyAdapter = this.propertyAccess.getAdapter(object); final PropertyAdapter propertyAdapter = classPropertyAdapter .getPropertyAdapter(labelProperty); final ValueEncoder encoder = this.valueEncoderSource.getValueEncoder(propertyAdapter .getType()); final Object label = propertyAdapter.get(object); return encoder.toClient(label); } }
public JpaValueEncoder(final EntityType<E> entity, final EntityManagerManager entityManagerManager, final String persistenceUnitName, final PropertyAccess propertyAccess, final TypeCoercer typeCoercer, final Logger logger) { super(); this.entity = entity; this.entityManagerManager = entityManagerManager; this.persistenceUnitName = persistenceUnitName; this.typeCoercer = typeCoercer; this.logger = logger; final Type<?> idType = this.entity.getIdType(); final SingularAttribute<? super E, ?> idAttribute = this.entity.getId(idType.getJavaType()); idPropertyName = idAttribute.getName(); propertyAdapter = propertyAccess.getAdapter(entity.getJavaType()).getPropertyAdapter( idPropertyName); }
public JpaValueEncoder(final EntityType<E> entity, final EntityManagerManager entityManagerManager, final String persistenceUnitName, final PropertyAccess propertyAccess, final TypeCoercer typeCoercer, final Logger logger) { super(); this.entity = entity; this.entityManagerManager = entityManagerManager; this.persistenceUnitName = persistenceUnitName; this.typeCoercer = typeCoercer; this.logger = logger; final Type<?> idType = this.entity.getIdType(); final SingularAttribute<? super E, ?> idAttribute = this.entity.getId(idType.getJavaType()); idPropertyName = idAttribute.getName(); propertyAdapter = propertyAccess.getAdapter(entity.getJavaType()).getPropertyAdapter( idPropertyName); }
public Binding defaultBinding(String parameterName, ComponentResources resources) { assert InternalUtils.isNonBlank(parameterName); assert resources != null; String componentId = resources.getId(); Component container = resources.getContainer(); // Only provide a default binding if the container actually contains the property. // This sets up an error condition for when the parameter is not bound, and // the binding can't be deduced. if (propertyAccess.getAdapter(container).getPropertyAdapter(componentId) == null) return null; ComponentResources containerResources = resources.getContainerResources(); return bindingSource.newBinding( "default " + parameterName, containerResources, BindingConstants.PROP, componentId); }