Java 类org.hibernate.annotations.AnyMetaDef 实例源码

项目:lams    文件:BinderHelper.java   
public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, Mappings mappings) {
    AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class );
    AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class );
    boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() )
            || XPackage.class.isAssignableFrom( annotatedElement.getClass() );
    if ( defAnn != null ) {
        checkAnyMetaDefValidity( mustHaveName, defAnn, annotatedElement );
        bindAnyMetaDef( defAnn, mappings );
    }
    if ( defsAnn != null ) {
        for (AnyMetaDef def : defsAnn.value()) {
            checkAnyMetaDefValidity( mustHaveName, def, annotatedElement );
            bindAnyMetaDef( def, mappings );
        }
    }
}
项目:lams    文件:BinderHelper.java   
private static void bindAnyMetaDef(AnyMetaDef defAnn, Mappings mappings) {
    if ( isEmptyAnnotationValue( defAnn.name() ) ) return; //don't map not named definitions
    if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "Binding Any Meta definition: %s", defAnn.name() );
    }
    mappings.addAnyMetaDef( defAnn );
}
项目:elide    文件:Property.java   
@Any(metaColumn = @Column(name = "property_type"))
@AnyMetaDef(idType = "long", metaType = "string", metaValues = {
        @MetaValue(targetEntity = example.Tractor.class, value = "tractor"),
        @MetaValue(targetEntity = example.Smartphone.class, value = "smartphone")
})
@JoinColumn(name = "property_id")
@ToOne
public Device getMyStuff() {
    return myStuff;
}
项目:org.fastnate    文件:EntityProperty.java   
private void fillMetaDefs(final AttributeAccessor attribute, final GeneratorDialect dialect) {
    final AnyMetaDef metaDef = attribute.getAnnotation(AnyMetaDef.class);
    if (metaDef == null) {
        throw new IllegalArgumentException("Missing AnyMetaDef for " + attribute);
    }
    for (final MetaValue metaValue : metaDef.metaValues()) {
        this.anyClasses.put(metaValue.targetEntity(), PrimitiveColumnExpression.create(metaValue.value(), dialect));
    }
}
项目:lams    文件:Configuration.java   
protected void reset() {
        metadataSourceQueue = new MetadataSourceQueue();
        createReflectionManager();

        classes = new HashMap<String,PersistentClass>();
        imports = new HashMap<String,String>();
        collections = new HashMap<String,Collection>();
        tables = new TreeMap<String,Table>();

        namedQueries = new HashMap<String,NamedQueryDefinition>();
        namedSqlQueries = new HashMap<String,NamedSQLQueryDefinition>();
        sqlResultSetMappings = new HashMap<String, ResultSetMappingDefinition>();
        namedEntityGraphMap = new HashMap<String, NamedEntityGraphDefinition>();
        namedProcedureCallMap = new HashMap<String, NamedProcedureCallDefinition>(  );
        typeDefs = new HashMap<String,TypeDef>();
        filterDefinitions = new HashMap<String, FilterDefinition>();
        fetchProfiles = new HashMap<String, FetchProfile>();
        auxiliaryDatabaseObjects = new ArrayList<AuxiliaryDatabaseObject>();

        tableNameBinding = new HashMap();
        columnNameBindingPerTable = new HashMap();

        secondPasses = new ArrayList<SecondPass>();
        propertyReferences = new ArrayList<Mappings.PropertyReference>();
        extendsQueue = new HashMap<ExtendsQueueEntry, String>();

        xmlHelper = new XMLHelper();
        interceptor = EmptyInterceptor.INSTANCE;
        properties = Environment.getProperties();
        entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;

        sqlFunctions = new HashMap<String, SQLFunction>();

        entityTuplizerFactory = new EntityTuplizerFactory();
//      componentTuplizerFactory = new ComponentTuplizerFactory();

        identifierGeneratorFactory = new DefaultIdentifierGeneratorFactory();

        mappedSuperClasses = new HashMap<Class<?>, MappedSuperclass>();

        metadataSourcePrecedence = Collections.emptyList();

        namedGenerators = new HashMap<String, IdGenerator>();
        joins = new HashMap<String, Map<String, Join>>();
        classTypes = new HashMap<String, AnnotatedClassType>();
        generatorTables = new HashMap<String, Properties>();
        defaultNamedQueryNames = new HashSet<String>();
        defaultNamedNativeQueryNames = new HashSet<String>();
        defaultSqlResultSetMappingNames = new HashSet<String>();
        defaultNamedProcedure =  new HashSet<String>(  );
        defaultNamedGenerators = new HashSet<String>();
        uniqueConstraintHoldersByTable = new HashMap<Table, List<UniqueConstraintHolder>>();
        jpaIndexHoldersByTable = new HashMap<Table,List<JPAIndexHolder>>(  );
        mappedByResolver = new HashMap<String, String>();
        propertyRefResolver = new HashMap<String, String>();
        caches = new ArrayList<CacheHolder>();
        namingStrategyDelegator = LegacyNamingStrategyDelegator.DEFAULT_INSTANCE;
        setEntityResolver( new EJB3DTDEntityResolver() );
        anyMetaDefs = new HashMap<String, AnyMetaDef>();
        propertiesAnnotatedWithMapsId = new HashMap<XClass, Map<String, PropertyData>>();
        propertiesAnnotatedWithIdAndToOne = new HashMap<XClass, Map<String, PropertyData>>();
        specjProprietarySyntaxEnabled = System.getProperty( "hibernate.enable_specj_proprietary_syntax" ) != null;
    }
项目:lams    文件:Configuration.java   
public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException {
    if ( anyMetaDefs.containsKey( defAnn.name() ) ) {
        throw new AnnotationException( "Two @AnyMetaDef with the same name defined: " + defAnn.name() );
    }
    anyMetaDefs.put( defAnn.name(), defAnn );
}
项目:lams    文件:Configuration.java   
public AnyMetaDef getAnyMetaDef(String name) {
    return anyMetaDefs.get( name );
}
项目:lams    文件:Mappings.java   
public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException;
项目:lams    文件:Mappings.java   
public AnyMetaDef getAnyMetaDef(String name);