org.hibernate.property.access.spi.Setter Java Examples
The following examples show how to use
org.hibernate.property.access.spi.Setter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FieldToBeanResultTransformer.java From ueboot with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void initialize(String aliases[]) { PropertyAccessStrategyChainedImpl propertyAccessStrategy = new PropertyAccessStrategyChainedImpl(new PropertyAccessStrategy[]{PropertyAccessStrategyBasicImpl.INSTANCE, PropertyAccessStrategyFieldImpl.INSTANCE}); this.aliases = new String[aliases.length]; this.setters = new Setter[aliases.length]; for (int i = 0; i < aliases.length; i++) { String alias = aliases[i]; if (alias != null) { this.aliases[i] = alias; alias = CamelUtils.underlineToCamel(alias); try { this.setters[i] = propertyAccessStrategy.buildPropertyAccess(this.resultClass, alias).getSetter(); } catch (Exception e) { this.setters[i] = null; } } } isInitialized = true; }
Example #2
Source File: AbstractComponentTuplizer.java From lams with GNU General Public License v2.0 | 6 votes |
protected AbstractComponentTuplizer(Component component) { setComponentClass( component ); propertySpan = component.getPropertySpan(); getters = new Getter[propertySpan]; setters = new Setter[propertySpan]; Iterator iter = component.getPropertyIterator(); boolean foundCustomAccessor=false; int i = 0; while ( iter.hasNext() ) { Property prop = ( Property ) iter.next(); getters[i] = buildGetter( component, prop ); setters[i] = buildSetter( component, prop ); if ( !prop.isBasicPropertyAccessor() ) { foundCustomAccessor = true; } i++; } hasCustomAccessors = foundCustomAccessor; instantiator = buildInstantiator( component ); }
Example #3
Source File: AliasToBeanResultTransformer.java From lams with GNU General Public License v2.0 | 6 votes |
private void initialize(String[] aliases) { PropertyAccessStrategyChainedImpl propertyAccessStrategy = new PropertyAccessStrategyChainedImpl( PropertyAccessStrategyBasicImpl.INSTANCE, PropertyAccessStrategyFieldImpl.INSTANCE, PropertyAccessStrategyMapImpl.INSTANCE ); this.aliases = new String[ aliases.length ]; setters = new Setter[ aliases.length ]; for ( int i = 0; i < aliases.length; i++ ) { String alias = aliases[ i ]; if ( alias != null ) { this.aliases[ i ] = alias; setters[ i ] = propertyAccessStrategy.buildPropertyAccess( resultClass, alias ).getSetter(); } } isInitialized = true; }
Example #4
Source File: DynamicMapEntityTuplizer.java From lams with GNU General Public License v2.0 | 6 votes |
@Override protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) { ProxyFactory pf = new MapProxyFactory(); try { //TODO: design new lifecycle for ProxyFactory pf.postInstantiate( getEntityName(), null, null, null, null, null ); } catch (HibernateException he) { LOG.unableToCreateProxyFactory( getEntityName(), he ); pf = null; } return pf; }
Example #5
Source File: PojoEntityTuplizer.java From lams with GNU General Public License v2.0 | 5 votes |
protected ProxyFactory buildProxyFactoryInternal( PersistentClass persistentClass, Getter idGetter, Setter idSetter) { // TODO : YUCK!!! fix after HHH-1907 is complete return Environment.getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory( getFactory() ); // return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory(); }
Example #6
Source File: PropertyAccessStrategyBackRefImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return SetterImpl.INSTANCE; }
Example #7
Source File: DynamicMapComponentTuplizer.java From lams with GNU General Public License v2.0 | 4 votes |
protected Setter buildSetter(Component component, Property prop) { return PropertyAccessStrategyMapImpl.INSTANCE.buildPropertyAccess( null, prop.getName() ).getSetter(); }
Example #8
Source File: PojoComponentTuplizer.java From lams with GNU General Public License v2.0 | 4 votes |
protected Setter buildSetter(Component component, Property prop) { return prop.getSetter( this.componentClass ); }
Example #9
Source File: PojoEntityTuplizer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) { return mappedProperty.getSetter( mappedEntity.getMappedClass() ); }
Example #10
Source File: PojoEntityTuplizer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) { // determine the id getter and setter methods from the proxy interface (if any) // determine all interfaces needed by the resulting proxy /* * We need to preserve the order of the interfaces they were put into the set, since javassist will choose the * first one's class-loader to construct the proxy class with. This is also the reason why HibernateProxy.class * should be the last one in the order (on JBossAS7 its class-loader will be org.hibernate module's class- * loader, which will not see the classes inside deployed apps. See HHH-3078 */ Set<Class> proxyInterfaces = new java.util.LinkedHashSet<Class>(); Class mappedClass = persistentClass.getMappedClass(); Class proxyInterface = persistentClass.getProxyInterface(); if ( proxyInterface != null && !mappedClass.equals( proxyInterface ) ) { if ( !proxyInterface.isInterface() ) { throw new MappingException( "proxy must be either an interface, or the class itself: " + getEntityName() ); } proxyInterfaces.add( proxyInterface ); } if ( mappedClass.isInterface() ) { proxyInterfaces.add( mappedClass ); } Iterator<Subclass> subclasses = persistentClass.getSubclassIterator(); while ( subclasses.hasNext() ) { final Subclass subclass = subclasses.next(); final Class subclassProxy = subclass.getProxyInterface(); final Class subclassClass = subclass.getMappedClass(); if ( subclassProxy != null && !subclassClass.equals( subclassProxy ) ) { if ( !subclassProxy.isInterface() ) { throw new MappingException( "proxy must be either an interface, or the class itself: " + subclass.getEntityName() ); } proxyInterfaces.add( subclassProxy ); } } proxyInterfaces.add( HibernateProxy.class ); Iterator properties = persistentClass.getPropertyIterator(); Class clazz = persistentClass.getMappedClass(); while ( properties.hasNext() ) { Property property = (Property) properties.next(); Method method = property.getGetter( clazz ).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.gettersOfLazyClassesCannotBeFinal( persistentClass.getEntityName(), property.getName() ); } method = property.getSetter( clazz ).getMethod(); if ( method != null && Modifier.isFinal( method.getModifiers() ) ) { LOG.settersOfLazyClassesCannotBeFinal( persistentClass.getEntityName(), property.getName() ); } } Method idGetterMethod = idGetter == null ? null : idGetter.getMethod(); Method idSetterMethod = idSetter == null ? null : idSetter.getMethod(); Method proxyGetIdentifierMethod = idGetterMethod == null || proxyInterface == null ? null : ReflectHelper.getMethod( proxyInterface, idGetterMethod ); Method proxySetIdentifierMethod = idSetterMethod == null || proxyInterface == null ? null : ReflectHelper.getMethod( proxyInterface, idSetterMethod ); ProxyFactory pf = buildProxyFactoryInternal( persistentClass, idGetter, idSetter ); try { pf.postInstantiate( getEntityName(), mappedClass, proxyInterfaces, proxyGetIdentifierMethod, proxySetIdentifierMethod, persistentClass.hasEmbeddedIdentifier() ? (CompositeType) persistentClass.getIdentifier().getType() : null ); } catch (HibernateException he) { LOG.unableToCreateProxyFactory( getEntityName(), he ); pf = null; } return pf; }
Example #11
Source File: DynamicMapEntityTuplizer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) { return buildPropertyAccess( mappedProperty ).getSetter(); }
Example #12
Source File: PropertyAccessBasicImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #13
Source File: PropertyAccessEmbeddedImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return SetterImpl.INSTANCE; }
Example #14
Source File: PropertyAccessStrategyNoopImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return SetterImpl.INSTANCE; }
Example #15
Source File: ExtendPropertyAccess.java From mPaaS with Apache License 2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #16
Source File: PropertyAccessEnhancedImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected Setter fieldSetter(Class<?> containerJavaType, String propertyName, Field field) { return new EnhancedSetterImpl( containerJavaType, propertyName, field ); }
Example #17
Source File: PropertyAccessStrategyIndexBackRefImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return SetterImpl.INSTANCE; }
Example #18
Source File: PropertyAccessFieldImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #19
Source File: PropertyAccessMapImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #20
Source File: PropertyAccessMixedImpl.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #21
Source File: PropertyAccessMixedImpl.java From lams with GNU General Public License v2.0 | 4 votes |
protected Setter propertySetter(Class<?> containerJavaType, String propertyName, Method method) { return method == null ? null : new SetterMethodImpl( containerJavaType, propertyName, method ); }
Example #22
Source File: PropertyAccessMixedImpl.java From lams with GNU General Public License v2.0 | 4 votes |
protected Setter fieldSetter(Class<?> containerJavaType, String propertyName, Field field) { return new SetterFieldImpl( containerJavaType, propertyName, field ); }
Example #23
Source File: Property.java From lams with GNU General Public License v2.0 | 4 votes |
public Setter getSetter(Class clazz) throws PropertyNotFoundException, MappingException { return getPropertyAccessStrategy( clazz ).buildPropertyAccess( clazz, name ).getSetter(); }
Example #24
Source File: Component.java From lams with GNU General Public License v2.0 | 4 votes |
public ValueGenerationPlan( IdentifierGenerator subGenerator, Setter injector) { this.subGenerator = subGenerator; this.injector = injector; }
Example #25
Source File: Component.java From lams with GNU General Public License v2.0 | 4 votes |
private Setter injector(Property property, Class attributeDeclarer) { return property.getPropertyAccessStrategy( attributeDeclarer ) .buildPropertyAccess( attributeDeclarer, property.getName() ) .getSetter(); }
Example #26
Source File: DynamicPropertyAccess.java From mPaaS with Apache License 2.0 | 4 votes |
@Override public Setter getSetter() { return setter; }
Example #27
Source File: AbstractEntityTuplizer.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Build an appropriate Setter for the given property. * * @param mappedProperty The property to be accessed via the built Setter. * @param mappedEntity The entity information regarding the mapped entity owning this property. * * @return An appropriate Setter instance. */ protected abstract Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity);
Example #28
Source File: AbstractEntityTuplizer.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Build an appropriate ProxyFactory for the given mapped entity. * * @param mappingInfo The mapping information regarding the mapped entity. * @param idGetter The constructed Getter relating to the entity's id property. * @param idSetter The constructed Setter relating to the entity's id property. * * @return An appropriate ProxyFactory instance. */ protected abstract ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter);
Example #29
Source File: AbstractComponentTuplizer.java From lams with GNU General Public License v2.0 | votes |
protected abstract Setter buildSetter(Component component, Property prop);