本文整理汇总了Java中com.helger.jcodemodel.AbstractJClass.fullName方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractJClass.fullName方法的具体用法?Java AbstractJClass.fullName怎么用?Java AbstractJClass.fullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.helger.jcodemodel.AbstractJClass
的用法示例。
在下文中一共展示了AbstractJClass.fullName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readGetter
import com.helger.jcodemodel.AbstractJClass; //导入方法依赖的package包/类
GenerationResult<Void> readGetter(MethodUsage interfaceMethod, VariableDeclaration param, AbstractJType paramType, boolean isVarArg) {
GenerationProcess generation = new GenerationProcess();
for (JAnnotationUse annotationUsage: param.annotations()) {
AbstractJClass annotationClass = annotationUsage.getAnnotationClass();
if (!annotationClass.isError()) {
String annotationClassName = annotationClass.fullName();
if (annotationClassName != null && annotationClassName.equals(Getter.class.getName())) {
String getterName = annotationUsage.getParam("name", String.class);
if (getterName == null || getterName.equals(":auto"))
getterName = param.name();
MemberAccess accessLevel = annotationUsage.getParam("access", MemberAccess.class);
boolean isNullable = Source.isNullable(param);
FieldFlags flags = new FieldFlags(isNullable, isVarArg, accessLevel);
FieldConfiguration configuration = new FieldConfiguration(getterName, paramType, flags);
generation.processGenerationResult(read(interfaceMethod, param, configuration));
}
}
}
return generation.<Void>createGenerationResult(null);
}
示例2: readUpdater
import com.helger.jcodemodel.AbstractJClass; //导入方法依赖的package包/类
GenerationResult<Void> readUpdater(MethodUsage interfaceMethod, VariableDeclaration param, AbstractJType paramType, boolean isVarArg) {
GenerationProcess generation = new GenerationProcess();
for (JAnnotationUse annotationUsage: param.annotations()) {
AbstractJClass annotationClass = annotationUsage.getAnnotationClass();
if (!annotationClass.isError()) {
String annotationClassName = annotationClass.fullName();
if (annotationClassName != null && annotationClassName.equals(Updater.class.getName())) {
String updaterName = annotationUsage.getParam("name", String.class);
if (updaterName == null || updaterName.equals(":auto"))
updaterName = "with" + Source.capitalize(param.name());
MemberAccess accessLevel = annotationUsage.getParam("access", MemberAccess.class);
boolean isNullable = Source.isNullable(param);
FieldFlags flags = new FieldFlags(isNullable, isVarArg, accessLevel);
FieldConfiguration configuration = new FieldConfiguration(updaterName, paramType, flags);
generation.processGenerationResult(read(interfaceMethod, param, configuration));
}
}
}
return generation.<Void>createGenerationResult(null);
}
示例3: getNullability
import com.helger.jcodemodel.AbstractJClass; //导入方法依赖的package包/类
public static GenerationResult<Boolean> getNullability(AbstractJType type, String name, Collection<? extends JAnnotationUse> annotations) {
boolean hasNonnull = false;
boolean hasNullable = false;
for (JAnnotationUse annotationUse: annotations) {
AbstractJClass annotationClass = annotationUse.getAnnotationClass();
if (!annotationClass.isError()) {
String annotationClassName = annotationClass.fullName();
if (annotationClassName != null) {
if (annotationClassName.equals("javax.annotation.Nonnull")) {
hasNonnull = true;
}
if (annotationClassName.equals("javax.annotation.Nullable")) {
hasNullable = true;
}
}
}
}
if (hasNonnull && hasNullable)
return new GenerationResult<>(false, Collections.singletonList(MessageFormat.format("Parameter {0} is declared as both @Nullable and @Nonnull",
name)));
if (!type.isReference() && hasNullable)
return new GenerationResult<>(false, Collections.singletonList(MessageFormat.format("Parameter {0} is non-reference, but declared as @Nullable",
name)));
return new GenerationResult<>(hasNullable, Collections.<String>emptyList());
}
示例4: createStage1Model
import com.helger.jcodemodel.AbstractJClass; //导入方法依赖的package包/类
public GenerationResult<Stage1ValueClassModel> createStage1Model(JDefinedClass jVisitorModel, Visitor visitorAnnotation) {
GenerationProcess generation = new GenerationProcess();
if (error != null) {
generation.reportError(error);
return generation.createGenerationResult(null);
} else {
JAnnotationUse annotation = null;
for (JAnnotationUse anyAnnotation: jVisitorModel.annotations()) {
AbstractJClass annotationClass = anyAnnotation.getAnnotationClass();
if (!annotationClass.isError()) {
String fullName = annotationClass.fullName();
if (fullName != null && fullName.equals(GenerateValueClassForVisitor.class.getName()))
annotation = anyAnnotation;
}
}
if (annotation == null)
throw new IllegalStateException("ValueClassModelFactory can't be run for interface without " + GenerateValueClassForVisitor.class + " annotation");
VisitorDefinition visitorModel = generation.processGenerationResult(VisitorDefinition.createInstance(jVisitorModel, visitorAnnotation));
ValueClassConfiguration configuration = generation.processGenerationResult(ValueClassConfiguration.createInstance(visitorModel, annotation, valueClass));
Stage1ValueClassModel result = createStage1Model(configuration);
return generation.createGenerationResult(result);
}
}
示例5: createStage0Model
import com.helger.jcodemodel.AbstractJClass; //导入方法依赖的package包/类
public Stage0ValueClassModel createStage0Model(JDefinedClass bootModel, Visitor visitorAnnotation) {
GenerationProcess generation = new GenerationProcess();
JAnnotationUse annotation = null;
for (JAnnotationUse anyAnnotation: bootModel.annotations()) {
AbstractJClass annotationClass = anyAnnotation.getAnnotationClass();
if (!annotationClass.isError()) {
String fullName = annotationClass.fullName();
if (fullName != null && fullName.equals(GenerateValueClassForVisitor.class.getName()))
annotation = anyAnnotation;
}
}
if (annotation == null)
throw new IllegalStateException("ValueClassModelFactory can't be run for interface without " + GenerateValueClassForVisitor.class + " annotation");
VisitorDefinition visitorModel = generation.processGenerationResult(VisitorDefinition.createInstance(bootModel, visitorAnnotation));
ValueClassConfiguration configuration = generation.processGenerationResult(ValueClassConfiguration.createInstance(visitorModel, annotation));
int mods = configuration.isValueClassPublic() ? JMod.PUBLIC: JMod.NONE;
JDefinedClass valueClass;
try {
valueClass = factory.defineClass(bootModel._package().name(), mods, configuration.valueClassName());
} catch (JClassAlreadyExistsException ex) {
return new Stage0ValueClassModel("Class " + configuration.valueClassName() + " already exists");
}
JAnnotationUse generatedAnnotation = valueClass.annotate(Generated.class);
generatedAnnotation.param("value", GenerateValueClassForVisitorProcessor.class.getName());
Source.annotateParametersAreNonnullByDefault(valueClass);
return new Stage0ValueClassModel(valueClass);
}