本文整理汇总了Java中org.jboss.jandex.AnnotationInstance类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationInstance类的具体用法?Java AnnotationInstance怎么用?Java AnnotationInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationInstance类属于org.jboss.jandex包,在下文中一共展示了AnnotationInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSecondaryTableSources
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private Set<TableSource> createSecondaryTableSources() {
Set<TableSource> secondaryTableSources = new HashSet<TableSource>();
AnnotationInstance secondaryTables = JandexHelper.getSingleAnnotation(
getClassInfo(),
JPADotNames.SECONDARY_TABLES
);
AnnotationInstance secondaryTable = JandexHelper.getSingleAnnotation(
getClassInfo(),
JPADotNames.SECONDARY_TABLE
);
// collect all @secondaryTable annotations
List<AnnotationInstance> secondaryTableAnnotations = new ArrayList<AnnotationInstance>();
if ( secondaryTable != null ) {
secondaryTableAnnotations.add(
secondaryTable
);
}
if ( secondaryTables != null ) {
secondaryTableAnnotations.addAll(
Arrays.asList(
JandexHelper.getValue( secondaryTables, "value", AnnotationInstance[].class )
)
);
}
// create table sources
for ( AnnotationInstance annotationInstance : secondaryTableAnnotations ) {
secondaryTableSources.add( createTableSource( annotationInstance ) );
}
return secondaryTableSources;
}
示例2: process
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private void process(Map<String, String> paths, String className, List<AnnotationInstance> annotations)
throws MojoExecutionException {
AnnotationInstance rootAnnotation = getRootAnnotation(annotations);
processRootAnnotation(paths, className, rootAnnotation);
String pathInClass = getRootPath(rootAnnotation);
for (AnnotationInstance annotation : annotations) {
AnnotationValue value = annotation.value();
if (value != null) {
if (annotation.target().kind() != (AnnotationTarget.Kind.CLASS)) {
MethodInfo annotatedMethod = annotation.target().asMethod();
String path = new String();
path = addHttpVerb(path, annotatedMethod);
path = addProducer(path, annotatedMethod);
path = addConsumer(path, annotatedMethod);
String fullPath = path.concat(
pathInClass != null ? pathInClass.concat("/").concat(value.asString()) : value.asString());
addInPaths(paths, className, fullPath);
}
}
}
}
示例3: getAccessFromIdPosition
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
static JaxbAccessType getAccessFromIdPosition(DotName className, IndexBuilder indexBuilder) {
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
JaxbAccessType accessType = getAccessFromIdPosition( ormAnnotations );
if ( accessType == null ) {
accessType = getAccessFromIdPosition( indexedAnnotations );
}
if ( accessType == null ) {
ClassInfo parent = indexBuilder.getClassInfo( className );
if ( parent == null ) {
parent = indexBuilder.getIndexedClassInfo( className );
}
if ( parent != null ) {
DotName parentClassName = parent.superName();
accessType = getAccessFromIdPosition( parentClassName, indexBuilder );
}
}
return accessType;
}
示例4: getEntityAccess
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
static JaxbAccessType getEntityAccess(DotName className, IndexBuilder indexBuilder) {
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
JaxbAccessType accessType = getAccess( ormAnnotations );
if ( accessType == null ) {
accessType = getAccess( indexedAnnotations );
}
if ( accessType == null ) {
ClassInfo parent = indexBuilder.getClassInfo( className );
if ( parent == null ) {
parent = indexBuilder.getIndexedClassInfo( className );
}
if ( parent != null ) {
DotName parentClassName = parent.superName();
accessType = getEntityAccess( parentClassName, indexBuilder );
}
}
return accessType;
}
示例5: determineIdType
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private IdType determineIdType() {
List<AnnotationInstance> idAnnotations = findIdAnnotations( JPADotNames.ID );
List<AnnotationInstance> embeddedIdAnnotations = findIdAnnotations( JPADotNames.EMBEDDED_ID );
if ( !idAnnotations.isEmpty() && !embeddedIdAnnotations.isEmpty() ) {
throw new MappingException(
"@EmbeddedId and @Id cannot be used together. Check the configuration for " + getName() + "."
);
}
if ( !embeddedIdAnnotations.isEmpty() ) {
if ( embeddedIdAnnotations.size() == 1 ) {
return IdType.EMBEDDED;
}
else {
throw new AnnotationException( "Multiple @EmbeddedId annotations are not allowed" );
}
}
if ( !idAnnotations.isEmpty() ) {
return idAnnotations.size() == 1 ? IdType.SIMPLE : IdType.COMPOSED;
}
return IdType.NONE;
}
示例6: parserTableGenerator
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private AnnotationInstance parserTableGenerator(JaxbTableGenerator generator) {
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", generator.getName(), annotationValueList );
MockHelper.stringValue( "catalog", generator.getCatalog(), annotationValueList );
MockHelper.stringValue( "schema", generator.getSchema(), annotationValueList );
MockHelper.stringValue( "table", generator.getTable(), annotationValueList );
MockHelper.stringValue( "pkColumnName", generator.getPkColumnName(), annotationValueList );
MockHelper.stringValue( "valueColumnName", generator.getValueColumnName(), annotationValueList );
MockHelper.stringValue( "pkColumnValue", generator.getPkColumnValue(), annotationValueList );
MockHelper.integerValue( "initialValue", generator.getInitialValue(), annotationValueList );
MockHelper.integerValue( "allocationSize", generator.getAllocationSize(), annotationValueList );
nestedUniqueConstraintList( "uniqueConstraints", generator.getUniqueConstraint(), annotationValueList );
return
create(
TABLE_GENERATOR, null, annotationValueList
);
}
示例7: nestedJoinColumnList
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private AnnotationValue[] nestedJoinColumnList(String name, List<JaxbJoinColumn> columns, List<AnnotationValue> annotationValueList) {
if ( MockHelper.isNotEmpty( columns ) ) {
AnnotationValue[] values = new AnnotationValue[columns.size()];
for ( int i = 0; i < columns.size(); i++ ) {
AnnotationInstance annotationInstance = parserJoinColumn( columns.get( i ), null );
values[i] = MockHelper.nestedAnnotationValue(
"", annotationInstance
);
}
MockHelper.addToCollectionIfNotNull(
annotationValueList, AnnotationValue.createArrayValue( name, values )
);
return values;
}
return MockHelper.EMPTY_ANNOTATION_VALUE_ARRAY;
}
示例8: parserMapKeyJoinColumn
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private AnnotationInstance parserMapKeyJoinColumn(JaxbMapKeyJoinColumn column, AnnotationTarget target) {
if ( column == null ) {
return null;
}
List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
MockHelper.stringValue( "name", column.getName(), annotationValueList );
MockHelper.stringValue( "columnDefinition", column.getColumnDefinition(), annotationValueList );
MockHelper.stringValue( "table", column.getTable(), annotationValueList );
MockHelper.stringValue(
"referencedColumnName", column.getReferencedColumnName(), annotationValueList
);
MockHelper.booleanValue( "unique", column.isUnique(), annotationValueList );
MockHelper.booleanValue( "nullable", column.isNullable(), annotationValueList );
MockHelper.booleanValue( "insertable", column.isInsertable(), annotationValueList );
MockHelper.booleanValue( "updatable", column.isUpdatable(), annotationValueList );
return create( MAP_KEY_JOIN_COLUMN, target, annotationValueList );
}
示例9: findTransientFieldAndMethodNames
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
/**
* Populates the sets of transient field and method names.
*/
private void findTransientFieldAndMethodNames() {
List<AnnotationInstance> transientMembers = classInfo.annotations().get( JPADotNames.TRANSIENT );
if ( transientMembers == null ) {
return;
}
for ( AnnotationInstance transientMember : transientMembers ) {
AnnotationTarget target = transientMember.target();
if ( target instanceof FieldInfo ) {
transientFieldNames.add( ( (FieldInfo) target ).name() );
}
else {
transientMethodNames.add( ( (MethodInfo) target ).name() );
}
}
}
示例10: findAssociationOverrides
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private List<AnnotationInstance> findAssociationOverrides() {
List<AnnotationInstance> associationOverrideList = new ArrayList<AnnotationInstance>();
AnnotationInstance associationOverrideAnnotation = JandexHelper.getSingleAnnotation(
classInfo,
JPADotNames.ASSOCIATION_OVERRIDE
);
if ( associationOverrideAnnotation != null ) {
associationOverrideList.add( associationOverrideAnnotation );
}
AnnotationInstance associationOverridesAnnotation = JandexHelper.getSingleAnnotation(
classInfo,
JPADotNames.ASSOCIATION_OVERRIDES
);
if ( associationOverrideAnnotation != null ) {
AnnotationInstance[] attributeOverride = associationOverridesAnnotation.value().asNestedArray();
Collections.addAll( associationOverrideList, attributeOverride );
}
return associationOverrideList;
}
示例11: MappedAttribute
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
MappedAttribute(String name, Class<?> attributeType, String accessType, Map<DotName, List<AnnotationInstance>> annotations, EntityBindingContext context) {
this.context = context;
this.annotations = annotations;
this.name = name;
this.attributeType = attributeType;
this.accessType = accessType;
//if this attribute has either @Id or @EmbeddedId, then it is an id attribute
AnnotationInstance idAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ID );
AnnotationInstance embeddedIdAnnotation = JandexHelper.getSingleAnnotation(
annotations,
JPADotNames.EMBEDDED_ID
);
isId = ( idAnnotation != null || embeddedIdAnnotation != null );
AnnotationInstance columnAnnotation = JandexHelper.getSingleAnnotation(
annotations,
JPADotNames.COLUMN
);
columnValues = new ColumnValues( columnAnnotation );
this.isOptimisticLockable = checkOptimisticLockAnnotation();
}
示例12: checkBasicAnnotation
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private void checkBasicAnnotation() {
AnnotationInstance basicAnnotation = JandexHelper.getSingleAnnotation( annotations(), JPADotNames.BASIC );
if ( basicAnnotation != null ) {
FetchType fetchType = FetchType.LAZY;
AnnotationValue fetchValue = basicAnnotation.value( "fetch" );
if ( fetchValue != null ) {
fetchType = Enum.valueOf( FetchType.class, fetchValue.asEnum() );
}
this.isLazy = fetchType == FetchType.LAZY;
AnnotationValue optionalValue = basicAnnotation.value( "optional" );
if ( optionalValue != null ) {
this.isOptional = optionalValue.asBoolean();
}
}
}
示例13: checkGeneratedAnnotation
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private void checkGeneratedAnnotation() {
AnnotationInstance generatedAnnotation = JandexHelper.getSingleAnnotation(
annotations(),
HibernateDotNames.GENERATED
);
if ( generatedAnnotation != null ) {
this.isInsertable = false;
AnnotationValue generationTimeValue = generatedAnnotation.value();
if ( generationTimeValue != null ) {
GenerationTime genTime = Enum.valueOf( GenerationTime.class, generationTimeValue.asEnum() );
if ( GenerationTime.ALWAYS.equals( genTime ) ) {
this.isUpdatable = false;
this.propertyGeneration = PropertyGeneration.parse( genTime.toString().toLowerCase() );
}
}
}
}
示例14: getAllColumnTransformerAnnotations
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private List<AnnotationInstance> getAllColumnTransformerAnnotations() {
List<AnnotationInstance> allColumnTransformerAnnotations = new ArrayList<AnnotationInstance>();
// not quite sure about the usefulness of @ColumnTransformers (HF)
AnnotationInstance columnTransformersAnnotations = JandexHelper.getSingleAnnotation(
annotations(),
HibernateDotNames.COLUMN_TRANSFORMERS
);
if ( columnTransformersAnnotations != null ) {
AnnotationInstance[] annotationInstances = allColumnTransformerAnnotations.get( 0 ).value().asNestedArray();
allColumnTransformerAnnotations.addAll( Arrays.asList( annotationInstances ) );
}
AnnotationInstance columnTransformerAnnotation = JandexHelper.getSingleAnnotation(
annotations(),
HibernateDotNames.COLUMN_TRANSFORMER
);
if ( columnTransformerAnnotation != null ) {
allColumnTransformerAnnotations.add( columnTransformerAnnotation );
}
return allColumnTransformerAnnotations;
}
示例15: createCustomReadWrite
import org.jboss.jandex.AnnotationInstance; //导入依赖的package包/类
private String[] createCustomReadWrite(List<AnnotationInstance> columnTransformerAnnotations) {
String[] readWrite = new String[2];
boolean alreadyProcessedForColumn = false;
for ( AnnotationInstance annotationInstance : columnTransformerAnnotations ) {
String forColumn = annotationInstance.value( "forColumn" ) == null ?
null : annotationInstance.value( "forColumn" ).asString();
if ( forColumn != null && !forColumn.equals( getName() ) ) {
continue;
}
if ( alreadyProcessedForColumn ) {
throw new AnnotationException( "Multiple definition of read/write conditions for column " + getName() );
}
readWrite[0] = annotationInstance.value( "read" ) == null ?
null : annotationInstance.value( "read" ).asString();
readWrite[1] = annotationInstance.value( "write" ) == null ?
null : annotationInstance.value( "write" ).asString();
alreadyProcessedForColumn = true;
}
return readWrite;
}