本文整理汇总了Java中org.apache.maven.plugins.annotations.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于org.apache.maven.plugins.annotations包,在下文中一共展示了Component类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTypeFields
import org.apache.maven.plugins.annotations.Component; //导入依赖的package包/类
private void processTypeFields(TypeElement type, MojoDescriptor descriptor) {
// non-static fields
for (Element member : type.getEnclosedElements()) {
if (member instanceof VariableElement) {
Parameter parameter = member.getAnnotation(Parameter.class);
Component component = member.getAnnotation(Component.class);
if (parameter != null && component != null) {
// TODO error marker
}
if (parameter != null) {
descriptor.addParameter(toParameterDescriptor((VariableElement) member, parameter));
} else if (component != null) {
descriptor.addRequirement(toComponentDescriptor((VariableElement) member, component));
}
}
}
}
示例2: getAnnotatedTypes
import org.apache.maven.plugins.annotations.Component; //导入依赖的package包/类
private Set<TypeElement> getAnnotatedTypes(RoundEnvironment roundEnv) {
Set<TypeElement> types = new HashSet<>();
roundEnv.getElementsAnnotatedWith(Mojo.class).forEach(type -> types.add((TypeElement) type));
addAnnotatedMembers(types, roundEnv, Parameter.class);
addAnnotatedMembers(types, roundEnv, Component.class);
return types;
}
示例3: getSupportedAnnotationTypes
import org.apache.maven.plugins.annotations.Component; //导入依赖的package包/类
@Override
public Set<String> getSupportedAnnotationTypes() {
Set<String> types = new HashSet<>();
types.add(Mojo.class.getName());
types.add(Parameter.class.getName());
types.add(Component.class.getName());
return types;
}
示例4: toComponentDescriptor
import org.apache.maven.plugins.annotations.Component; //导入依赖的package包/类
private MojoRequirement toComponentDescriptor(VariableElement field, Component component) {
MojoRequirement result = new MojoRequirement();
result.setFieldName(field.getSimpleName().toString());
result.setRole(getComponentRole(field, component));
result.setRoleHint(component.hint());
return result;
}
示例5: getComponentRole
import org.apache.maven.plugins.annotations.Component; //导入依赖的package包/类
private String getComponentRole(VariableElement field, Component component) {
String role;
try {
role = component.role().getName();
} catch (MirroredTypeException e) {
role = e.getTypeMirror().toString();
}
if (!Object.class.getName().equals(role)) {
return role;
}
return getTypeString(field.asType());
}