use of java.lang.annotation.ElementType in project dolphin-platform by canoo.
the class ActionControllerTest method testCallPublicMethodWithElementTypeParams.
/**
* End UUID Type Related Integration Test
*/
/**
* Start ElementType Type Related Integration Test
*/
@Test(dataProvider = ENDPOINTS_DATAPROVIDER, description = "Tests if an public action method with ElementType param can be called")
public void testCallPublicMethodWithElementTypeParams(String containerType, String endpoint) {
final ElementType value = ElementType.PARAMETER;
performActionForElementType(containerType, endpoint, PUBLIC_WITH_ELEMENT_TYPE_PARAM_ACTION, value, new Param(PARAM_NAME, value));
}
use of java.lang.annotation.ElementType in project wire by square.
the class JavaGenerator method generateOptionType.
// Example:
//
// @Retention(RetentionPolicy.RUNTIME)
// @Target(ElementType.FIELD)
// public @interface MyFieldOption {
// String value();
// }
@Nullable
public TypeSpec generateOptionType(Extend extend, Field field) {
checkArgument(extend.getFields().contains(field));
if (!emitDeclaredOptions)
return null;
ElementType elementType = annotationTargetType(extend);
if (elementType == null)
return null;
if (!eligibleAsAnnotationMember(schema, field))
return null;
TypeName returnType = typeName(field.getType());
ClassName javaType = generatedTypeName(field);
TypeSpec.Builder builder = TypeSpec.annotationBuilder(javaType.simpleName()).addModifiers(PUBLIC).addAnnotation(AnnotationSpec.builder(Retention.class).addMember("value", "$T.$L", RetentionPolicy.class, RetentionPolicy.RUNTIME).build()).addAnnotation(AnnotationSpec.builder(Target.class).addMember("value", "$T.$L", ElementType.class, elementType).build());
if (!field.getDocumentation().isEmpty()) {
builder.addJavadoc("$L\n", field.getDocumentation());
}
builder.addMethod(MethodSpec.methodBuilder("value").returns(returnType).addModifiers(PUBLIC, ABSTRACT).build());
return builder.build();
}
Aggregations