public DynamicComponentSource(ReflectionManager reflectionManager, Component component, XProperty baseProperty) { super( reflectionManager.toXClass( Map.class ), component ); this.baseProperty = baseProperty; } }
private void categorizeAnnotatedClass(Class annotatedClass, AttributeConverterManager attributeConverterManager) { final XClass xClass = reflectionManager.toXClass( annotatedClass ); // categorize it, based on assumption it does not fall into multiple categories if ( xClass.isAnnotationPresent( Converter.class ) ) { //noinspection unchecked attributeConverterManager.addAttributeConverter( annotatedClass ); } else if ( xClass.isAnnotationPresent( Entity.class ) || xClass.isAnnotationPresent( MappedSuperclass.class ) ) { xClasses.add( xClass ); } else if ( xClass.isAnnotationPresent( Embeddable.class ) ) { xClasses.add( xClass ); } else { log.debugf( "Encountered a non-categorized annotated class [%s]; ignoring", annotatedClass.getName() ); } }
public XClass getPropertyClass() throws MappingException { if ( property.isAnnotationPresent( Target.class ) ) { return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() ); } else { return property.getType(); } }
public XClass getClassOrElement() throws MappingException { if ( property.isAnnotationPresent( Target.class ) ) { return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() ); } else { return property.getClassOrElementClass(); } }
public static XClass getTargetEntity(PropertyData propertyData, MetadataBuildingContext buildingContext) { XProperty property = propertyData.getProperty(); return buildingContext.getBootstrapContext().getReflectionManager().toXClass( getTargetEntityClass( property ) ); }
@SuppressWarnings({ "unchecked" }) public void setProxy(Proxy proxy) { if ( proxy != null ) { lazy = proxy.lazy(); if ( !lazy ) { proxyClass = null; } else { final ReflectionManager reflectionManager = context.getBootstrapContext().getReflectionManager(); if ( AnnotationBinder.isDefault( reflectionManager.toXClass( proxy.proxyClass() ), context ) ) { proxyClass = annotatedClass; } else { proxyClass = reflectionManager.toXClass( proxy.proxyClass() ); } } } else { lazy = true; //needed to allow association lazy loading. proxyClass = annotatedClass; } }
private void buildHierarchyColumnOverride(XClass element) { XClass current = element; Map<String, Column[]> columnOverride = new HashMap<String, Column[]>(); Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>(); Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>(); Map<String, ForeignKey> foreignKeyOverride = new HashMap<String, ForeignKey>(); while ( current != null && !context.getBootstrapContext().getReflectionManager().toXClass( Object.class ).equals( current ) ) { if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class ) || current.isAnnotationPresent( Embeddable.class ) ) { //FIXME is embeddable override? Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() ); Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() ); Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() ); Map<String, ForeignKey> currentForeignKeyOverride = buildForeignKeyOverride( current, getPath() ); currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses currentJoinTableOverride.putAll( joinTableOverride ); //subclasses have precedence over superclasses currentForeignKeyOverride.putAll( foreignKeyOverride ); //subclasses have precedence over superclasses columnOverride = currentOverride; joinColumnOverride = currentJoinOverride; joinTableOverride = currentJoinTableOverride; foreignKeyOverride = currentForeignKeyOverride; } current = current.getSuperclass(); } holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null; holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null; holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null; holderForeignKeyOverride = foreignKeyOverride.size() > 0 ? foreignKeyOverride : null; }
if ( allClassAudited != null && allClassAudited.auditParents().length > 0 ) { for ( Class c : allClassAudited.auditParents() ) { final XClass parentClass = reflectionManager.toXClass( c ); checkSuperclass( clazz, parentClass ); if ( !overriddenNotAuditedClasses.contains( parentClass ) ) { for ( AuditOverride auditOverride : auditOverrides ) { if ( auditOverride.forClass() != void.class ) { final XClass overrideClass = reflectionManager.toXClass( auditOverride.forClass() ); checkSuperclass( clazz, overrideClass ); final String propertyName = auditOverride.name();
Callback callback = null; if ( listener != null ) { XClass xListener = reflectionManager.toXClass( listener ); callbacksMethodNames = new ArrayList<>(); List<XMethod> methods = xListener.getDeclaredMethods();
final XClass idClass = context.getBootstrapContext().getReflectionManager().toXClass( associatedClassWithIdClass.getAnnotation( IdClass.class ).value() );
/** * Read a mapping from the class annotation metadata (JSR 175). * * @param persistentClass the mapped class * * @return the configuration object * * @throws MappingException in case there is a configuration error for the specified class */ public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws MappingException { XClass persistentXClass = reflectionManager.toXClass( persistentClass ); try { annotatedClasses.add( persistentXClass ); return this; } catch ( MappingException me ) { log.error( "Could not compile the mapping annotations", me ); throw me; } }
.toXClass( Serializable.class ) .isAssignableFrom( returnedClassOrElement ) ) { type = SerializableToBlobType.class.getName();
if ( classWithIdClass != null ) { IdClass idClass = classWithIdClass.getAnnotation( IdClass.class ); XClass compositeClass = context.getBootstrapContext().getReflectionManager().toXClass( idClass.value() ); PropertyData inferredData = new PropertyPreloadedData( entityBinder.getPropertyAccessType(), "id", compositeClass
public InheritanceState(XClass clazz, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings) { this.setClazz( clazz ); this.mappings = mappings; this.inheritanceStatePerClass = inheritanceStatePerClass; this.identifierType = mappings.getReflectionManager().toXClass( void.class ); //not initialized extractInheritanceType(); }
public static XClass getTargetEntity(PropertyData propertyData, ExtendedMappings mappings) { XProperty property = propertyData.getProperty(); return mappings.getReflectionManager().toXClass( getTargetEntityClass( property ) ); }
public XClass getClassOrElement() throws MappingException { if ( property.isAnnotationPresent( Target.class ) ) { return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() ); } else { return property.getClassOrElementClass(); } }
private void buildHierarchyColumnOverride(XClass element) { XClass current = element; Map<String, Column[]> columnOverride = new HashMap<String, Column[]>(); Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>(); Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>(); while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) { if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class ) || current.isAnnotationPresent( Embeddable.class ) ) { //FIXME is embeddable override? Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() ); Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() ); Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() ); currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses columnOverride = currentOverride; joinColumnOverride = currentJoinOverride; joinTableOverride = currentJoinTableOverride; } current = current.getSuperclass(); } holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null; holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null; holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null; }
public XClass getPropertyClass() throws MappingException { if ( property.isAnnotationPresent( Target.class ) ) { return reflectionManager.toXClass( property.getAnnotation( Target.class ).value() ); } else { return property.getType(); } }
@SuppressWarnings({ "unchecked" }) public void setProxy(Proxy proxy) { if ( proxy != null ) { lazy = proxy.lazy(); if ( !lazy ) { proxyClass = null; } else { if ( AnnotationBinder.isDefault( mappings.getReflectionManager().toXClass( proxy.proxyClass() ), mappings ) ) { proxyClass = annotatedClass; } else { proxyClass = mappings.getReflectionManager().toXClass( proxy.proxyClass() ); } } } else { lazy = true; //needed to allow association lazy loading. proxyClass = annotatedClass; } }
mappedBy = oneToManyAnn.mappedBy(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( oneToManyAnn.targetEntity() ) ); collectionBinder.setCascadeStrategy( final Class<?> targetElement = elementCollectionAnn.targetClass(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( targetElement ) ); mappedBy = manyToManyAnn.mappedBy(); collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( manyToManyAnn.targetEntity() ) ); collectionBinder.setCascadeStrategy( mappedBy = ""; collectionBinder.setTargetEntity( context.getBootstrapContext().getReflectionManager().toXClass( void.class ) ); collectionBinder.setCascadeStrategy( getCascadeStrategy( null, hibernateCascade, false, false ) );