/** * buid a property holder on top of a collection */ public static CollectionPropertyHolder buildPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, MetadataBuildingContext context) { return new CollectionPropertyHolder( collection, path, clazzToProcess, property, parentPropertyHolder, context ); }
public CollectionPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, MetadataBuildingContext context) { super( path, parentPropertyHolder, clazzToProcess, context ); this.collection = collection; setCurrentProperty( property ); this.elementAttributeConversionInfoMap = new HashMap<>(); this.keyAttributeConversionInfoMap = new HashMap<>(); }
private void buildAttributeConversionInfoMaps( XProperty collectionProperty, Map<String,AttributeConversionInfo> elementAttributeConversionInfoMap, Map<String,AttributeConversionInfo> keyAttributeConversionInfoMap) { if ( collectionProperty == null ) { // not sure this is valid condition return; } { final Convert convertAnnotation = collectionProperty.getAnnotation( Convert.class ); if ( convertAnnotation != null ) { applyLocalConvert( convertAnnotation, collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap ); } } { final Converts convertsAnnotation = collectionProperty.getAnnotation( Converts.class ); if ( convertsAnnotation != null ) { for ( Convert convertAnnotation : convertsAnnotation.value() ) { applyLocalConvert( convertAnnotation, collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap ); } } } }
public ConverterDescriptor mapKeyAttributeConverterDescriptor(XProperty mapXProperty, XClass keyXClass) { AttributeConversionInfo info = locateAttributeConversionInfo( "key" ); if ( info != null ) { if ( info.isConversionDisabled() ) { return null; } else { try { return makeAttributeConverterDescriptor( info ); } catch (Exception e) { throw buildExceptionFromInstantiationError( info, e ); } } } log.debugf( "Attempting to locate auto-apply AttributeConverter for collection key [%s]", collection.getRole() ); // todo : do we need to pass along `XClass keyXClass`? return getContext().getMetadataCollector() .getAttributeConverterAutoApplyHandler() .findAutoApplyConverterForMapKey( mapXProperty, getContext() ); }
holder.prepare( property ); keyXClass, this.collection.getOwnerEntityName(), holder.mapKeyAttributeConverterDescriptor( property, keyXClass ) ); elementBinder.setPersistentClassName( propertyHolder.getEntityName() );
private Class determineElementClass(XClass elementXClass) { if ( elementXClass != null ) { try { return getContext().getBootstrapContext().getReflectionManager().toClass( elementXClass ); } catch (Exception e) { log.debugf( "Unable to resolve XClass [%s] to Class for collection elements [%s]", elementXClass.getName(), collection.getRole() ); } } if ( collection.getElement() != null ) { if ( collection.getElement().getType() != null ) { return collection.getElement().getType().getReturnedClass(); } } // currently this is called from paths where the element type really should be known, // so log the fact that we could not resolve the collection element info log.debugf( "Unable to resolve element information for collection [%s]", collection.getRole() ); return null; }
buildAttributeConversionInfoMaps( collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap );
public ConverterDescriptor resolveElementAttributeConverterDescriptor(XProperty collectionXProperty, XClass elementXClass) { AttributeConversionInfo info = locateAttributeConversionInfo( "element" ); if ( info != null ) { if ( info.isConversionDisabled() ) { return null; } else { try { return makeAttributeConverterDescriptor( info ); } catch (Exception e) { throw buildExceptionFromInstantiationError( info, e ); } } } log.debugf( "Attempting to locate auto-apply AttributeConverter for collection element [%s]", collection.getRole() ); // todo : do we need to pass along `XClass elementXClass`? return getContext().getMetadataCollector() .getAttributeConverterAutoApplyHandler() .findAutoApplyConverterForCollectionElement( collectionXProperty, getContext() ); }
holder.prepare( property ); keyXClass, this.collection.getOwnerEntityName(), holder.mapKeyAttributeConverterDescriptor( property, keyXClass ) ); elementBinder.setPersistentClassName( propertyHolder.getEntityName() );
private Class determineKeyClass(XClass keyXClass) { if ( keyXClass != null ) { try { return getContext().getBootstrapContext().getReflectionManager().toClass( keyXClass ); } catch (Exception e) { log.debugf( "Unable to resolve XClass [%s] to Class for collection key [%s]", keyXClass.getName(), collection.getRole() ); } } final IndexedCollection indexedCollection = (IndexedCollection) collection; if ( indexedCollection.getIndex() != null ) { if ( indexedCollection.getIndex().getType() != null ) { return indexedCollection.getIndex().getType().getReturnedClass(); } } // currently this is called from paths where the element type really should be known, // so log the fact that we could not resolve the collection element info log.debugf( "Unable to resolve key information for collection [%s]", collection.getRole() ); return null; } }
buildAttributeConversionInfoMaps( collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap );
public ConverterDescriptor mapKeyAttributeConverterDescriptor(XProperty mapXProperty, XClass keyXClass) { AttributeConversionInfo info = locateAttributeConversionInfo( "key" ); if ( info != null ) { if ( info.isConversionDisabled() ) { return null; } else { try { return makeAttributeConverterDescriptor( info ); } catch (Exception e) { throw buildExceptionFromInstantiationError( info, e ); } } } log.debugf( "Attempting to locate auto-apply AttributeConverter for collection key [%s]", collection.getRole() ); // todo : do we need to pass along `XClass keyXClass`? return getContext().getMetadataCollector() .getAttributeConverterAutoApplyHandler() .findAutoApplyConverterForMapKey( mapXProperty, getContext() ); }
public CollectionPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, ExtendedMappings mappings ) { super( path, parentPropertyHolder, clazzToProcess, mappings ); this.collection = collection; setCurrentProperty( property ); }
/** * buid a property holder on top of a collection */ public static PropertyHolder buildPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, ExtendedMappings mappings ) { return new CollectionPropertyHolder( collection, path, clazzToProcess, property, parentPropertyHolder, mappings ); }
private Class determineElementClass(XClass elementXClass) { if ( elementXClass != null ) { try { return getContext().getBootstrapContext().getReflectionManager().toClass( elementXClass ); } catch (Exception e) { log.debugf( "Unable to resolve XClass [%s] to Class for collection elements [%s]", elementXClass.getName(), collection.getRole() ); } } if ( collection.getElement() != null ) { if ( collection.getElement().getJavaTypeMapping() != null ) { return collection.getElement().getJavaTypeMapping().getJavaTypeDescriptor().getJavaType(); } } // currently this is called from paths where the element type really should be known, // so log the fact that we could not resolve the collection element info log.debugf( "Unable to resolve element information for collection [%s]", collection.getRole() ); return null; }
private void buildAttributeConversionInfoMaps( XProperty collectionProperty, Map<String,AttributeConversionInfo> elementAttributeConversionInfoMap, Map<String,AttributeConversionInfo> keyAttributeConversionInfoMap) { if ( collectionProperty == null ) { // not sure this is valid condition return; } { final Convert convertAnnotation = collectionProperty.getAnnotation( Convert.class ); if ( convertAnnotation != null ) { applyLocalConvert( convertAnnotation, collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap ); } } { final Converts convertsAnnotation = collectionProperty.getAnnotation( Converts.class ); if ( convertsAnnotation != null ) { for ( Convert convertAnnotation : convertsAnnotation.value() ) { applyLocalConvert( convertAnnotation, collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap ); } } } }
public ConverterDescriptor resolveElementAttributeConverterDescriptor(XProperty collectionXProperty, XClass elementXClass) { AttributeConversionInfo info = locateAttributeConversionInfo( "element" ); if ( info != null ) { if ( info.isConversionDisabled() ) { return null; } else { try { return makeAttributeConverterDescriptor( info ); } catch (Exception e) { throw buildExceptionFromInstantiationError( info, e ); } } } log.debugf( "Attempting to locate auto-apply AttributeConverter for collection element [%s]", collection.getRole() ); // todo : do we need to pass along `XClass elementXClass`? return getContext().getMetadataCollector() .getAttributeConverterAutoApplyHandler() .findAutoApplyConverterForCollectionElement( collectionXProperty, getContext() ); }
public CollectionPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, ExtendedMappings mappings ) { super( path, parentPropertyHolder, clazzToProcess, mappings ); this.collection = collection; setCurrentProperty( property ); }
/** * buid a property holder on top of a collection */ public static PropertyHolder buildPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, ExtendedMappings mappings ) { return new CollectionPropertyHolder( collection, path, clazzToProcess, property, parentPropertyHolder, mappings ); }
public CollectionPropertyHolder( Collection collection, String path, XClass clazzToProcess, XProperty property, PropertyHolder parentPropertyHolder, Mappings mappings) { super( path, parentPropertyHolder, clazzToProcess, mappings ); this.collection = collection; setCurrentProperty( property ); }