public static boolean isAnnotationPresent(Annotation[] annotations, Class<? extends Annotation> annotationType, boolean meta){ return null != getAnnotation(annotations, annotationType, meta); }
public static <T extends Annotation> T getAnnotation(Annotation[] annotations,Class<T> annotationType){ return getAnnotation(annotations, annotationType, false); }
public static boolean isAnnotationPresent(Annotation[] annotations, Class<? extends Annotation> annotationType){ return null != getAnnotation(annotations, annotationType); }
/** * Returns the annotation of the given type or null if not exists. */ default <T extends Annotation> T getAnnotation(Class<T> annotationType) { return Classes.getAnnotation(getAnnotations(), annotationType); }
@Override public void preMappingField(MetadataContext context, EntityMappingBuilder emb, FieldMappingBuilder fmb) throws MetadataException { Annotation[] annotations = fmb.getAnnotations(); if(null != annotations && annotations.length > 0){ mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Column.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Unique.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Id.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,GeneratedValue.class)); mappingFieldColumnByDomain(context, emb, fmb, Classes.getAnnotation(annotations, leap.orm.annotation.Domain.class)); mappingFieldColumnByMetaName(context, emb, fmb, Classes.getAnnotation(annotations,MetaName.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,NotEmpty.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,NotNull.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Required.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Filterable.class)); mappingFieldColumnByAnnotation(context, emb, fmb, Classes.getAnnotation(annotations,Sortable.class)); } }
@Override public void postMappingField(MetadataContext context, EntityMappingBuilder emb, FieldMappingBuilder fmb) throws MetadataException { Annotation[] annotations = fmb.getAnnotations(); if(null != annotations && annotations.length > 0){ mappingFieldColumnIndex(context, emb, fmb, Classes.getAnnotation(annotations,Index.class)); } }
Property p = Classes.getAnnotation(annotations, Property.class, true); if(null != p) { if(p.required().isPresent()) { Discriminator discriminator = Classes.getAnnotation(annotations, Discriminator.class); if(null != discriminator) { mp.setDiscriminator(true); Sortable sortable = Classes.getAnnotation(annotations, Sortable.class, true); if(null != sortable) { mp.setSortable(sortable.value()); Filterable filterable = Classes.getAnnotation(annotations, Filterable.class, true); if(null != filterable) { mp.setFilterable(filterable.value()); Creatable creatable = Classes.getAnnotation(annotations, Creatable.class, true); if(null != creatable) { mp.setCreatable(creatable.value()); Updatable updatable = Classes.getAnnotation(annotations, Updatable.class, true); if(null != updatable) { mp.setUpdatable(updatable.value());
Inject inject = Classes.getAnnotation(annotations, Inject.class);
LeapBeanSupport.disable(); Qualifier qualifier = Classes.getAnnotation(descriptor.getAnnotations(), Qualifier.class); if(null == qualifier) { bean = Global.factory().resolveInjectValue(type, genericType);
protected void mappingEntityKeys(MetadataContext context, EntityMappingBuilder emb) { for(FieldMappingBuilder fm : emb.getFieldMappings()) { Annotation[] annotations = fm.getAnnotations(); if(null != annotations) { Unique unique = Classes.getAnnotation(annotations, Unique.class); if(null != unique && !Strings.isEmpty(unique.value())) { String name = unique.value(); UniqueKeyBuilder key = emb.getKey(name); if(null == key) { key = new UniqueKeyBuilder(name); emb.addKey(key); } key.addField(fm.getFieldName()); } } } }
leap.orm.annotation.Domain a = Classes.getAnnotation(fmb.getAnnotations(), leap.orm.annotation.Domain.class); if(null == a || a.autoMapping()) { Domain domain = context.getMetadata().domains().autoMapping(emb.getEntityName(), fmb.getFieldName());