项目:GitHub
文件:IncludeTypes.java
void use() {
// this immutable type (package style used)
ImIncludeTypes.builder().build();
// included on this type (package style used)
imserializable.builder().build();
// included on package (package style used)
ImTicker.builder().read(1).build();
// included in IncludenestedTypes
ImmutableIncludenestedTypes.Retention retention =
ImmutableIncludenestedTypes.Retention.builder()
.value(RetentionPolicy.CLASS)
.build();
// included in IncludenestedTypes
ImmutableIncludenestedTypes.Target target =
ImmutableIncludenestedTypes.Target.builder()
.value(ElementType.CONSTRUCTOR,ElementType.ANNOTATION_TYPE)
.build();
// package applied style "copyWith*" test
// see PackageStyle
retention.copyWithValue(RetentionPolicy.RUNTIME);
target.copyWithValue(ElementType.CONSTRUCTOR,ElementType.LOCAL_VARIABLE);
}
项目:GitHub
文件:Annotations.java
static boolean annotationMatchesTarget(Element annotationElement,ElementType elementType) {
@Nullable Target target = annotationElement.getAnnotation(Target.class);
if (target != null) {
ElementType[] targettypes = target.value();
if (targettypes.length == 0) {
return false;
}
boolean found = false;
for (ElementType t : targettypes) {
if (t == elementType) {
found = true;
}
}
if (!found) {
return false;
}
}
return true;
}
项目:GitHub
文件:ValueAttribute.java
public List<CharSequence> getBuilderAttributeAnnotation() {
if (containingType.isGenerateJacksonProperties()
&& protoclass().isJacksonDeserialized()) {
List<CharSequence> jacksonPropertyAnnotation = Annotations.getAnnotationLines(element,Collections.singleton(Annotations.JACKSON_PROPERTY),false,ElementType.METHOD,importsResolver,nullability);
List<CharSequence> annotations = Lists.newArrayList();
if (jacksonPropertyAnnotation.isEmpty()) {
annotations.add(jacksonPropertyAnnotation());
}
annotations.addAll(Annotations.getAnnotationLines(element,Collections.<String>emptySet(),protoclass().environment().hasJacksonLib(),nullability));
return annotations;
}
return ImmutableList.of();
}
项目:GitHub
文件:ValueAttribute.java
private List<CharSequence> extractAnnotationsForElement(ElementType elementType,Set<String> additionalAnnotations) {
List<CharSequence> allAnnotations = Lists.newArrayListWithCapacity(1);
boolean dontHaveJsonPropetyAnnotationAlready = Annotations.getAnnotationLines(element,elementType,nullability).isEmpty();
if (dontHaveJsonPropetyAnnotationAlready) {
allAnnotations.add(jacksonPropertyAnnotation());
}
allAnnotations.addAll(
Annotations.getAnnotationLines(element,Sets.union(additionalAnnotations,protoclass().styles().style().additionalJsonAnnotationsNames()),nullability));
return allAnnotations;
}
@Test
public void ttlOnPropertyLevel() throws Exception {
Map<String,Object> settings = new HashMap<String,Object>();
TestHelper.configureOptionsFor( settings,Redis.class )
.associationStorage( AssociationStorageType.ASSOCIATION_DOCUMENT )
.entity( Cloud.class )
.property( "backupSNowFlakes",ElementType.METHOD )
.ttl( 1,TimeUnit.DAYS );
setupSessionFactory( settings );
createCloudWithTwoProducedAndOneBackupSNowflake();
// property-level options are applied to the type as well.
// not sure,whether this is a good idea.
assertthat( cloudTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
.isLessthanorEqualTo( TimeUnit.HOURS.toMillis( 24 ) );
assertthat( associationTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
.isLessthanorEqualTo( TimeUnit.HOURS.toMillis( 24 ) );
}
private JDefinedClass buildTemplateConstraint(String name) {
try {
JDefinedClass tplConstraint = codemodel._class(Config.CFG.getBasePackageName() + ".annot."+name,Classtype.ANNOTATION_TYPE_DECL);
tplConstraint.annotate(Documented.class);
tplConstraint.annotate(Retention.class).param("value",RetentionPolicy.RUNTIME);
tplConstraint.annotate(Target.class).paramArray("value").param(ElementType.TYPE).param(ElementType.ANNOTATION_TYPE).param(ElementType.FIELD).param(ElementType.METHOD);
// Using direct as I don't kNow how to build default { } with code model
tplConstraint.direct("\n" + " Class<?>[] groups() default {};\n" + " String message() default \"Invalid value\";\n" + " Class<? extends Payload>[] payload() default {};\n");
// Hack to force the import of javax.validation.Payload
tplConstraint.javadoc().addThrows((JClass) codemodel._ref(Payload.class)).add("Force import");
return tplConstraint;
} catch (JClassAlreadyExistsException e) {
throw new RuntimeException("Tried to create an already existing class: " + name,e);
}
}
项目:oscm
文件:CommandContextTest.java
@Test
public void testGetEnumInvalid() {
args.put("key","CONSTRUCTOR");
Set<ElementType> all = EnumSet.noneOf(ElementType.class);
all.add(ElementType.FIELD);
all.add(ElementType.METHOD);
System.out.print(all);
try {
ctx.getEnum("key",all);
fail("IllegalArgumentException expected.");
} catch (IllegalArgumentException e) {
assertEquals(
"Invalid parameter value 'CONSTRUCTOR' for key. Valid values are [FIELD,METHOD].",e.getMessage());
}
}
项目:atlas
文件:AnnotationLister.java
/**
* Inspects a class annotation.
*
* @param cf {@code non-null;} class file
* @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,BaseAnnotations ann) {
if (!args.eTypes.contains(ElementType.TYPE)) {
return;
}
for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
String annClassName
= anAnn.getType().getClasstype().getClassName();
if (args.aclass.equals(annClassName)) {
printMatch(cf);
}
}
}
项目:javaide
文件:AnnotationLister.java
/**
* Inspects a class annotation.
*
* @param cf {@code non-null;} class file
* @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,BaseAnnotations ann) {
if (!args.eTypes.contains(ElementType.TYPE)) {
return;
}
for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
String annClassName
= anAnn.getType().getClasstype().getClassName();
if (args.aclass.equals(annClassName)) {
printMatch(cf);
}
}
}
@Test
public void testConstraintViolationExceptionParameter() {
final Wine bean = new Wine();
final Set<ConstraintViolation<?>> violations = new LinkedHashSet<>();
final ConstraintHelper helper = new ConstraintHelper();
final ConstraintDescriptor<NotEmpty> notEmptyNameDescriptor = new ConstraintDescriptorImpl<>(helper,(Member) null,getAnnotation("name",NotEmpty.class),ElementType.FIELD);
PathImpl path = PathImpl.createPathFromString("name");
violations.add(ConstraintViolationImpl.<Wine> forParameterValidation("name-Empty",null,"interpolated",Wine.class,bean,new Object(),"value",path,notEmptyNameDescriptor,ElementType.ParaMETER,null));
path.addParameterNode("parameter1",0);
final ConstraintViolationException violationException = Mockito.mock(ConstraintViolationException.class);
Mockito.when(violationException.getConstraintViolations()).thenReturn(violations);
final ValidationjsonException validationjsonException = new ValidationjsonException(violationException);
Assert.assertFalse(validationjsonException.getErrors().isEmpty());
Assert.assertEquals("{parameter1=[{rule=name-Empty}]}",validationjsonException.getErrors().toString());
}
项目:multidex-maker
文件:AnnotationLister.java
/**
* Inspects a class annotation.
*
* @param cf {@code non-null;} class file
* @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,BaseAnnotations ann) {
if (!args.eTypes.contains(ElementType.TYPE)) {
return;
}
for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
String annClassName
= anAnn.getType().getClasstype().getClassName();
if (args.aclass.equals(annClassName)) {
printMatch(cf);
}
}
}
项目:xtext-extras
文件:XAnnotationUtil.java
public Set<ElementType> getAnnotationTargets(JvmAnnotationType annotation) {
EList<JvmAnnotationReference> annotations = annotation.getAnnotations();
for (JvmAnnotationReference annoref : annotations) {
if (Target.class.getName().equals(annoref.getAnnotation().getIdentifier())) {
EList<JvmAnnotationValue> values = annoref.getValues();
JvmAnnotationValue value = values.isEmpty() ? null : values.get(0);
if (value instanceof JvmEnumAnnotationValue) {
Set<ElementType> result = newHashSet();
for (JvmEnumerationLiteral elementType : ((JvmEnumAnnotationValue) value).getValues()) {
final String simpleName = elementType.getSimpleName();
result.add(ElementType.valueOf(simpleName));
}
return result;
}
}
}
return emptySet();
}
/** Return simple name representation of this type declaration. */
public Name toName() {
String packageName = "";
if (getcompilationunit() != null) {
packageName = getcompilationunit().getPackageName();
}
List<String> simpleNames = new ArrayList<>();
TypeDeclaration current = this;
while (current != null) {
simpleNames.add(0,current.getName());
current = current.getEnclosingDeclaration();
}
Name name = new Name(packageName,simpleNames);
name.getModifiers().addAll(getModifiers());
name.setTarget(ElementType.TYPE);
return name;
}
项目:listing
文件:Name.java
/** Create new Name based on the array of Strings,with the first denoting the package name. */
public static Name of(String... names) {
requireNonNull(names,"names");
if (names.length == 0) {
throw new IllegalArgumentException("non-empty names array expected");
}
List<String> simples = new ArrayList<>(Arrays.asList(names));
Iterator<String> iterator = simples.iterator();
String packageName = iterator.next();
iterator.remove();
if (!simples.stream().allMatch(SourceVersion::isIdentifier)) {
throw new IllegalArgumentException("non-name in: " + simples);
}
Name name = new Name(packageName,simples);
if (names.length == 1) {
name.setTarget(ElementType.PACKAGE);
} else if (names.length == 2) {
name.setTarget(ElementType.TYPE);
}
return name;
}
@Test
void singleStaticImport() throws Exception {
Member micros = TimeUnit.class.getField("MICROSECONDS");
Name parameter = Name.of("java.lang.annotation","ElementType","ParaMETER");
parameter.setTarget(ElementType.FIELD);
parameter.setModifiers(Modifier.PUBLIC,Modifier.STATIC,Modifier.FINAL);
check(
imports ->
imports
.addSingleStaticImport(Thread.State.NEW)
.addSingleStaticImport(micros)
.addSingleStaticImport(parameter),"import static java.lang.Thread.State.NEW;","import static java.lang.annotation.ElementType.ParaMETER;","import static java.util.concurrent.TimeUnit.MICROSECONDS;");
}
@Test
void simple() {
assertEquals("int i",MethodParameter.of(int.class,"i").list());
assertEquals("int... ia1",MethodParameter.of(int[].class,"ia1").setvariable(true).list());
assertEquals("int[]... ia2",MethodParameter.of(int[][].class,"ia2").setvariable(true).list());
MethodParameter parameter =
new MethodParameter().setType(new TypeVariable()).setName("t").setFinal(true);
parameter.addAnnotation(new Annotation(Name.of("","A")));
assertEquals("final @A T t",parameter.list());
assertEquals(ElementType.ParaMETER,new MethodParameter().getAnnotationTarget());
IllegalStateException expected =
expectThrows(
IllegalStateException.class,() -> MethodParameter.of(int.class,"i").setvariable(true));
assertEquals(true,expected.toString().contains("array type expected"));
}
项目:listing
文件:NameTest.java
@Test
void testToString() {
assertEquals("Name{a.b.X,target=Optional[TYPE],modifiers=[]}",of("a.b","X").toString());
testToString(of(Object.class),"java.lang.Object","public");
testToString(of(byte.class),"byte","public,abstract,final");
testToString(of(Object[].class),"Object[]",final");
testToString(of(Object[][].class),"Object[][]",final");
testToString(of(Name.class),Name.class.getCanonicalName(),"public");
testToString(of(Character.Subset.class),"java.lang.Character.Subset",static");
testToString(of(Thread.State.class),"java.lang.Thread.State",static,final");
testToString(
of(Thread.State.NEW),"java.lang.Thread.State.NEW",ElementType.FIELD,final");
testToString(normalClassDeclaration.of("Abc").toName(),"Abc","");
testToString(compilationunit.of("abc").declareClass("Abc").toName(),"abc.Abc","");
}
项目:BoostSRL
文件:Utils.java
/** Creates the power set of the items in elements.
*
* This version of the method will modify the elements list
* as the power set is built.
*
* @param <ElementType> Type of elements.
* @param elements Items to create power set over.
* @return Returns power set of elements.
*/
private static <ElementType> Set<Set<ElementType>> getPowerSetDestructive(Set<ElementType> elements) {
if ( elements.isEmpty() ) {
return Collections.EMPTY_SET;
}
else if ( elements.size() == 1 ) {
HashSet<Set<ElementType>> s = new HashSet<Set<ElementType>>();
s.add(Collections.EMPTY_SET);
s.add(Collections.singleton(elements.iterator().next()));
return s;
}
else {
ElementType e = elements.iterator().next(); // Next is gaurantee to work,since we check isEmpty
elements.remove(e);
Set<Set<ElementType>> pT = getPowerSetDestructive(elements);
Set<Set<ElementType>> cross = getCrossproduct(pT,e);
pT.addAll(cross);
return pT;
}
}
项目:listing
文件:JavaMirrorsTest.java
@Test
void rootAnnotation() {
compilationunit unit = compilationunit.of("test");
Annotation annotation = Annotation.of(All.class);
annotation.addobject("o",Annotation.of(Target.class,ElementType.TYPE));
annotation.addobject("p",4711);
annotation.addobject("r",Double.class);
annotation.addobject("r",Float.class);
normalClassDeclaration type = unit.declareClass("Root");
type.addAnnotation(annotation);
type.addTypeParameter(TypeParameter.of("X"));
mark(type.declareField(TypeVariable.of("X"),"i"));
Counter counter = new Counter();
Compilation.compile(null,emptyList(),asList(counter),asList(unit.toJavaFileObject()));
assertEquals(1,counter.annotations.size());
assertEquals(annotation.list(),counter.annotations.get(0).list());
}
static AnnotationMetadata bindAnnotationMetadata(
turbineTyKind kind,Iterable<AnnoInfo> annotations) {
if (kind != turbineTyKind.ANNOTATION) {
return null;
}
RetentionPolicy retention = null;
ImmutableSet<ElementType> target = null;
ClassSymbol repeatable = null;
for (AnnoInfo annotation : annotations) {
switch (annotation.sym().binaryName()) {
case "java/lang/annotation/Retention":
retention = bindRetention(annotation);
break;
case "java/lang/annotation/Target":
target = bindTarget(annotation);
break;
case "java/lang/annotation/Repeatable":
repeatable = bindRepeatable(annotation);
break;
default:
break;
}
}
return new AnnotationMetadata(retention,target,repeatable);
}
private static ImmutableSet<ElementType> bindTarget(AnnoInfo annotation) {
ImmutableSet.Builder<ElementType> result = ImmutableSet.builder();
Const val = annotation.values().get("value");
switch (val.kind()) {
case ARRAY:
for (Const element : ((ArrayInitValue) val).elements()) {
if (element.kind() == Kind.ENUM_CONSTANT) {
bindTargetElement(result,(EnumConstantValue) element);
}
}
break;
case ENUM_CONSTANT:
bindTargetElement(result,(EnumConstantValue) val);
break;
default:
break;
}
return result.build();
}
private static MethodInfo bindMethod(Env<ClassSymbol,TypeBoundClass> env,MethodInfo base) {
ImmutableList.Builder<AnnoInfo> declarationAnnotations = ImmutableList.builder();
Type returnType =
disambiguate(
env,base.name().equals("<init>") ? ElementType.CONSTRUCTOR : ElementType.METHOD,base.returnType(),base.annotations(),declarationAnnotations);
return new MethodInfo(
base.sym(),base.tyParams(),returnType,bindParameters(env,base.parameters()),base.exceptions(),base.access(),base.defaultValue(),base.decl(),declarationAnnotations.build(),base.receiver() != null ? bindParam(env,base.receiver()) : null);
}
/**
* Moves type annotations in {@code annotations} to {@code type},and adds any declaration
* annotations on {@code type} to {@code declarationAnnotations}.
*/
private static Type disambiguate(
Env<ClassSymbol,ElementType declarationTarget,Type type,ImmutableList<AnnoInfo> annotations,Builder<AnnoInfo> declarationAnnotations) {
// desugar @Repeatable annotations before disambiguating: annotation containers may target
// a subset of the types targeted by their element annotation
annotations = groupRepeated(env,annotations);
ImmutableList.Builder<AnnoInfo> typeAnnotations = ImmutableList.builder();
for (AnnoInfo anno : annotations) {
Set<ElementType> target = env.get(anno.sym()).annotationMetadata().target();
if (target.contains(ElementType.TYPE_USE)) {
typeAnnotations.add(anno);
}
if (target.contains(declarationTarget)) {
declarationAnnotations.add(anno);
}
}
return addAnnotationsToType(type,typeAnnotations.build());
}
@Override
public AnnotationMetadata get() {
if ((access() & turbineFlag.ACC_ANNOTATION) != turbineFlag.ACC_ANNOTATION) {
return null;
}
RetentionPolicy retention = null;
ImmutableSet<ElementType> target = null;
ClassSymbol repeatable = null;
for (ClassFile.AnnotationInfo annotation : classFile.get().annotations()) {
switch (annotation.typeName()) {
case "Ljava/lang/annotation/Retention;":
retention = bindRetention(annotation);
break;
case "Ljava/lang/annotation/Target;":
target = bindTarget(annotation);
break;
case "Ljava/lang/annotation/Repeatable;":
repeatable = bindRepeatable(annotation);
break;
default:
break;
}
}
return new AnnotationMetadata(retention,repeatable);
}
private static ImmutableSet<ElementType> bindTarget(AnnotationInfo annotation) {
ImmutableSet.Builder<ElementType> result = ImmutableSet.builder();
ElementValue val = annotation.elementValuePairs().get("value");
switch (val.kind()) {
case ARRAY:
for (ElementValue element : ((ArrayValue) val).elements()) {
if (element.kind() == Kind.ENUM) {
bindTargetElement(result,(EnumConstValue) element);
}
}
break;
case ENUM:
bindTargetElement(result,(EnumConstValue) val);
break;
default:
break;
}
return result.build();
}
public void compileAnnotations (AttrContainer container,ElementType etype)
{
if (container == null)
return;
int n = numAnnotations();
for (int i = 0; i < n; i++)
{
Object ann = getAnnotation(i).valueIfConstant();
if (ann != null)
{
AnnotationEntry ae = (AnnotationEntry) Proxy.getInvocationHandler(ann);
if (container != null && ae.hasTarget(etype))
RuntimeAnnotationsAttr.maybeAddAnnotation(container,ae);
}
}
}
项目:Lyrics
文件:TypeModel.java
public TypeModel(Type type,Modifier[] modifiers,VariableModel extendsType,Set<VariableModel> interfaces,List<GenericVariableModel> genericVariables,List<AnnotationModel> annotations,Map<String,FieldModel> fields,MethodModel> methods,InclusionType inclusion,List<String> values,Object[]> valuesWithFields,List<String> fieldOrder,SubTypeModel subTypes,RetentionPolicy retention,ElementType[] elementTypes,List<String> customConstructorFields) {
this.type = type;
this.modifiers = modifiers;
this.extendsType = extendsType;
this.interfaces = interfaces;
this.genericVariables = genericVariables;
this.annotations = annotations;
this.fields = fields;
this.methods = methods;
this.inclusion = inclusion;
this.values = values;
this.valuesWithFields = valuesWithFields;
this.fieldOrder = fieldOrder;
this.subTypes = subTypes;
this.retention = retention;
this.elementTypes = elementTypes;
this.customConstructorFields = customConstructorFields;
}
项目:dex
文件:AnnotationLister.java
/**
* Inspects a class annotation.
*
* @param cf {@code non-null;} class file
* @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,BaseAnnotations ann) {
if (!args.eTypes.contains(ElementType.TYPE)) {
return;
}
for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
String annClassName
= anAnn.getType().getClasstype().getClassName();
if (args.aclass.equals(annClassName)) {
printMatch(cf);
}
}
}
@Test
public void loadAndCheckAnnotatedAnnotation() throws Exception {
ClassInfo classInfo = ClassInfo.newAnnotation()
.name("org.kordamp.naum.processor.klass.AnnotatedAnnotation")
.iface(Annotation.class.getName())
.build();
classInfo.addToAnnotations(annotationInfo()
.name(Retention.class.getName())
.annotationValue("value",new EnumValue(RetentionPolicy.class.getName(),"SOURCE"))
.build());
classInfo.addToAnnotations(annotationInfo()
.name(Target.class.getName())
.annotationValue("value",newArrayValue(asList(
newEnumValue(ElementType.class.getName(),ElementType.TYPE.name()),newEnumValue(ElementType.class.getName(),ElementType.FIELD.name()))
))
.build());
loadAndCheck("org/kordamp/naum/processor/klass/AnnotatedAnnotation.class",(klass) -> {
assertthat(klass.getContentHash(),equalTo(classInfo.getContentHash()));
assertthat(klass,equalTo(classInfo));
});
}
/**
* Note that:
*
* <pre>
* If no annotation matches the specified parameter,the property will be ignored.
* </pre>
*
* @param key
* @param expectedType
* @return the configured value
*/
private <U> U lookup(String key,Class<U> expectedType) {
Config config = getConfig();
Optional<U> value = null;
if (ElementType.METHOD.equals(annotationSource)) {
// <classname>/<methodname>/<annotation>/<parameter>
value = config.getoptionalValue(getConfigKeyForMethod() + key,expectedType);
} else {
// <classname>/<annotation>/<parameter>
value = config.getoptionalValue(getConfigKeyForClass() + key,expectedType);
}
if (!value.isPresent()) {
// <annotation>/<parameter>
value = config.getoptionalValue(getConfigType().getSimpleName() + "/" + key,expectedType);
}
// annotation values
return value.isPresent() ? value.get() : getConfigFromAnnotation(key);
}
项目:JCL
文件:AnnotationLister.java
/**
* Inspects a class annotation.
*
* @param cf {@code non-null;} class file
* @param ann {@code non-null;} annotation
*/
private void visitClassAnnotation(DirectClassFile cf,BaseAnnotations ann) {
if (!args.eTypes.contains(ElementType.TYPE)) {
return;
}
for (Annotation anAnn : ann.getAnnotations().getAnnotations()) {
String annClassName
= anAnn.getType().getClasstype().getClassName();
if (args.aclass.equals(annClassName)) {
printMatch(cf);
}
}
}
项目:GitHub
文件:Annotations.java
static List<CharSequence> getAnnotationLines(
Element element,Set<String> includeAnnotations,boolean includeJacksonAnnotations,ElementType elementType,Function<String,String> importsResolver,@Nullable NullabilityAnnotationInfo nullability) {
return getAnnotationLines(element,includeAnnotations,includeJacksonAnnotations,nullability);
}
项目:GitHub
文件:Annotations.java
static List<CharSequence> getAnnotationLines(
Element element,boolean includeAllAnnotations,@Nullable NullabilityAnnotationInfo nullability) {
List<CharSequence> lines = Lists.newArrayList();
Set<String> seenAnnotations = new HashSet<>();
for (AnnotationMirror annotation : element.getAnnotationMirrors()) {
TypeElement annotationElement = (TypeElement) annotation.getAnnotationType().asElement();
if (annotationTypeMatches(element,annotationElement,includeAllAnnotations,seenAnnotations,lines,nullability)
&& annotationMatchesTarget(annotationElement,elementType)) {
lines.add(AnnotationMirrors.tocharSequence(annotation,importsResolver));
}
}
return lines;
}
项目:GitHub
文件:ValueType.java
public List<CharSequence> getBuilderAnnotations() {
Optional<DeclaringType> declaringType = constitution.protoclass().declaringType();
if (declaringType.isPresent() && declaringType.get().jacksonSerializeMode() == JacksonMode.BUILDER) {
return Annotations.getAnnotationLines(
element,true,ElementType.TYPE,newTypestringResolver(),null);
}
return ImmutableList.of();
}
项目:GitHub
文件:ValueType.java
public List<CharSequence> passedAnnotations() {
return Annotations.getAnnotationLines(
element,Sets.union(
constitution.style().passAnnotationsNames(),constitution.style().additionalJsonAnnotationsNames()),null);
}
项目:GitHub
文件:ValueAttribute.java
public List<CharSequence> getAnnotations() {
if (containingType.isGenerateJacksonProperties()) {
return extractAnnotationsForElement(
ElementType.METHOD,protoclass().styles().style().passAnnotationsNames());
}
return Annotations.getAnnotationLines(element,protoclass().styles().style().passAnnotationsNames(),nullability);
}
项目:GitHub
文件:ValueAttribute.java
public List<CharSequence> getFieldAnnotations() {
return Annotations.getAnnotationLines(element,null/* do not propagate nullable here */);
}
项目:GitHub
文件:ValueAttribute.java
项目:GitHub
文件:NullabilityAnnotationInfo.java
项目:oscm
文件:CommandContextTest.java
@Test
public void testGetEnumOptionalInvalid() {
args.put("key","CONSTRUCTOR");
Set<ElementType> all = EnumSet.noneOf(ElementType.class);
all.add(ElementType.FIELD);
all.add(ElementType.METHOD);
assertEquals(null,ctx.getEnumOptional("key",all));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。