本文整理汇总了Java中com.helger.jcodemodel.JMod.PUBLIC属性的典型用法代码示例。如果您正苦于以下问题:Java JMod.PUBLIC属性的具体用法?Java JMod.PUBLIC怎么用?Java JMod.PUBLIC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.helger.jcodemodel.JMod
的用法示例。
在下文中一共展示了JMod.PUBLIC属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitConstant_def
@Override
public Void visitConstant_def(Constant_defContext ctx) {
String constName = ctx.constant_name().IDENTIFIER().getText();
String constType = ctx.constant_type().TYPE_LITERAL().getText();
Literal_valueContext lit = ctx.literal_value();
ProtoTypes type = ProtoTypes.valueOf( constType.toUpperCase() );
ProtoContext pkgCtx = (ProtoContext) ctx.getParent();
String pkg = pkgCtx.package_def().package_name().QUALIFIED_IDENTIFIER().getText();
JDefinedClass container = codeModel._package( pkg )._getClass( containerName );
int modifier = JMod.PUBLIC | JMod.STATIC | JMod.FINAL;
AbstractJType jtype = primitiveType( type ).unboxify();
JFieldVar f = container.field( modifier, jtype, constName.toUpperCase(), parse( type, container, lit ) );
logger.info( "\t +-> {} {} = {}", f.type().name(), f.name(), lit.getText() );
return super.visitConstant_def( ctx );
}
示例2: toJMod
public static int toJMod(MemberAccess accessLevel) {
switch (accessLevel) {
case PRIVATE:
return JMod.PRIVATE;
case PACKAGE:
return JMod.NONE;
case PROTECTED:
return JMod.PROTECTED;
case PUBLIC:
return JMod.PUBLIC;
default:
throw new IllegalStateException("Unsupported AccessLevel: " + accessLevel);
}
}
示例3: createStage0Model
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);
}
示例4: visitPackage_def
@Override
public Void visitPackage_def(Package_defContext ctx) {
Void v = super.visitPackage_def( ctx );
String pkg = ctx.package_name().getText().trim();
JDefinedClass container = codeModel._package( pkg )._getClass( containerName );
int mod = JMod.PUBLIC | JMod.STATIC | JMod.FINAL;
container.field( mod, String.class, SCHEMA_FIELD, JExpr.lit( schemaAsText ) );
container.field( mod, String.class, VERSION_FIELD, JExpr.lit( version ) );
return v;
}