当前位置: 首页>>代码示例>>Java>>正文


Java JMod.PUBLIC属性代码示例

本文整理汇总了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 );
}
 
开发者ID:turbospaces,项目名称:protoc,代码行数:19,代码来源:Antlr4ProtoVisitor.java

示例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);
    }
}
 
开发者ID:sviperll,项目名称:adt4j,代码行数:14,代码来源:Source.java

示例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);
}
 
开发者ID:sviperll,项目名称:adt4j,代码行数:27,代码来源:Stage0ValueClassModelFactory.java

示例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;
}
 
开发者ID:turbospaces,项目名称:protoc,代码行数:13,代码来源:Antlr4GenVisitor.java


注:本文中的com.helger.jcodemodel.JMod.PUBLIC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。