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


Java FieldSource类代码示例

本文整理汇总了Java中org.jboss.forge.roaster.model.source.FieldSource的典型用法代码示例。如果您正苦于以下问题:Java FieldSource类的具体用法?Java FieldSource怎么用?Java FieldSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FieldSource类属于org.jboss.forge.roaster.model.source包,在下文中一共展示了FieldSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyAccessTransformation

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
/**
 * Applies access transformations to a parsed type and all of its nested members.
 *
 * TODO: Add support for inheritance to reduce the size of AT configs.
 */
@SuppressWarnings("unchecked")
private void applyAccessTransformation(@Nonnull AccessTransformationMap transformationMap, @Nonnull JavaType classSource) {
    this.getLog().info("Applying access transformations to " + classSource.getQualifiedName());

    transformationMap.getTypeMappings(classSource.getQualifiedName()).ifPresent((t) -> {
        if (classSource instanceof VisibilityScopedSource) {
            t.getVisibility().ifPresent(((VisibilityScopedSource) classSource)::setVisibility);
        }

        if (classSource instanceof FieldHolderSource) {
            ((List<FieldSource>) ((FieldHolderSource) classSource).getFields()).forEach((f) -> t.getFieldVisibility(f.getName()).ifPresent(f::setVisibility));
        }

        if (classSource instanceof MethodHolderSource) {
            ((List<MethodSource>) ((MethodHolderSource) classSource).getMethods()).forEach((m) -> t.getMethodVisibility(m.getName()).ifPresent(m::setVisibility));
        }

        ((List<JavaType>) classSource.getNestedClasses()).forEach((c) -> this.applyAccessTransformation(transformationMap, c));
    });
}
 
开发者ID:BasinMC,项目名称:minecraft-maven-plugin,代码行数:26,代码来源:InitializeRepositoryMojo.java

示例2: createEntityIndexData

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private ComponentData createEntityIndexData(ComponentData data, List<FieldSource<JavaClassSource>> infos) {

        FieldSource<JavaClassSource> info = infos.stream()
                .filter(i -> i.hasAnnotation(EntityIndex.class))
                .collect(singletonCollector());

        setEntityIndexType(data, info.getAnnotation(EntityIndex.class).getName());
        isCustom(data, false);
        setEntityIndexName(data, data.getSource().getCanonicalName());
        setKeyType(data, info.getType().getName());
        setComponentType(data, data.getSource().getCanonicalName());
        setMemberName(data, info.getName());
        _contextsComponentDataProvider.provide(data);
        setContextNames(data, _contextsComponentDataProvider.getContextNames(data));

        return data;
    }
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:18,代码来源:EntityIndexDataProvider.java

示例3: visit

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public void visit(FieldSource<? extends JavaSource> fieldSource) {
    Type fieldType = fieldSource.getType();
    String fieldClassName;

    // the javadoc for Named.getName() is misleading:
    // the FieldSource.getName() (which is implemented by FieldImpl.getName())
    // returns the (fully-qualified!) name of the field
    String fieldName = fieldSource.getName();
    resParts.addPart(fieldName,
                     PartType.FIELD);

    if (fieldType.isPrimitive()) {
        fieldClassName = fieldType.getName();
    } else {
        fieldClassName = fieldType.getQualifiedName();
    }
    addJavaResourceReference(fieldClassName);

    // Field annotations
    for (AnnotationSource annoSource : fieldSource.getAnnotations()) {
        visit(annoSource);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:24,代码来源:TestJavaSourceVisitor.java

示例4: parseManagedTypesProperties

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public List<ObjectProperty> parseManagedTypesProperties(JavaClassSource javaClassSource,
                                                        ClassTypeResolver classTypeResolver) throws ModelDriverException {

    List<FieldSource<JavaClassSource>> fields = javaClassSource.getFields();
    List<ObjectProperty> properties = new ArrayList<ObjectProperty>();
    ObjectProperty property;

    for (FieldSource<JavaClassSource> field : fields) {
        if (DriverUtils.isManagedType(field.getType(),
                                      classTypeResolver)) {
            property = parseProperty(field,
                                     classTypeResolver);
            properties.add(property);
        } else {
            logger.debug("field: " + field + "with fieldName: " + field.getName() + " won't be loaded by the diver because type: " + field.getType().getName() + " isn't a managed type.");
        }
    }
    return properties;
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:JavaRoasterModelDriver.java

示例5: getField

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static FieldSource<JavaClassSource> getField(JavaClassSource clazz, Block block, SimpleName ref) {
    String fieldName = ref.getIdentifier();
    if (fieldName != null) {
        // find field in class
        FieldSource field = clazz != null ? clazz.getField(fieldName) : null;
        if (field == null) {
            field = findFieldInBlock(clazz, block, fieldName);
        }
        return field;
    }
    return null;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:14,代码来源:CamelJavaParserHelper.java

示例6: isNumericOperator

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private static boolean isNumericOperator(JavaClassSource clazz, Block block, Expression expression) {
    if (expression instanceof NumberLiteral) {
        return true;
    } else if (expression instanceof SimpleName) {
        FieldSource field = getField(clazz, block, (SimpleName) expression);
        if (field != null) {
            return field.getType().isType("int") || field.getType().isType("long")
                    || field.getType().isType("Integer") || field.getType().isType("Long");
        }
    }
    return false;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:CamelJavaParserHelper.java

示例7: addImports

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private void addImports(List<FieldSource<JavaClassSource>> memberInfos, JavaClassSource source) {
    for (FieldSource<JavaClassSource> info : memberInfos) {
        if (info.getOrigin().getImport(info.getType().toString()) != null) {
            if (source.getImport(info.getType().toString()) == null) {
                source.addImport(info.getType());
            }
        }
    }
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:10,代码来源:ContextGenerator.java

示例8: memberAssignments

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public String memberAssignments(List<FieldSource<JavaClassSource>> memberInfos) {
    String format = "component.%1$s = %2$s;";
    return memberInfos.stream().map(
            info -> {
                String newArg = info.getName();
                return String.format(format, info.getName(), newArg);
            }
    ).collect(Collectors.joining("\n"));

}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:11,代码来源:ComponentEntityGenerator.java

示例9: provide

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
@Override
public void provide(ComponentData data) {
    List<FieldSource<JavaClassSource>> fields = data.getSource().getFields();
    if(fields != null && fields.size() > 0) {
        setMemberData(data, data.getSource().getFields());
        setFlagComponent(data,false);
    } else {
        setMemberData(data, new ArrayList<FieldSource<JavaClassSource>>());
        setFlagComponent(data,true);
    }

}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:13,代码来源:MemberDataProvider.java

示例10: provideDataForNonComponent

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
List<ComponentData> provideDataForNonComponent(ComponentData data) {
    _contextsComponentDataProvider.provide(data);
    return getComponentNames(data.getSource()).stream()
            .map(componentName -> {
                ComponentTypeDataProvider.setFullTypeName(data, componentName);
                MemberDataProvider.setMemberData(data, new ArrayList<FieldSource<JavaClassSource>>() {{
                    add(new FieldImpl<JavaClassSource>(data.getSource()));
                }});
                return data;
            }).collect(Collectors.toList());

}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:13,代码来源:ComponentDataProvider.java

示例11: hasFieldIgnoreCase

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private boolean hasFieldIgnoreCase(JavaClassSource javaClass, PropertyDescription property) {
    for (FieldSource<JavaClassSource> fieldSource : javaClass.getFields()) {
        if (equalsIgnoreCase(property.getName(), fieldSource.getName())) {
            return true;
        }
    }
    return false;
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:9,代码来源:JavaFixtureGenerator.java

示例12: addArquillianResourceEnricher

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private void addArquillianResourceEnricher(JavaClassSource test) {
   if (asClient.hasValue())
   {
      test.addImport("org.jboss.arquillian.test.api.ArquillianResource");
      final FieldSource<JavaClassSource> urlField = test.addField();
      urlField
              .setName("url")
              .setType(URL.class)
              .setPrivate();

      urlField.addAnnotation("ArquillianResource");

   }
}
 
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:15,代码来源:CreateTestClassCommand.java

示例13: createTemporalField

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public Field<JavaClassSource> createTemporalField(JavaClassSource entityClass, String fieldName, TemporalType type)
         throws FileNotFoundException
{
   FieldSource<JavaClassSource> field = fieldOperations.addFieldTo(entityClass, Date.class.getCanonicalName(),
            fieldName,
            TemporalType.class.getCanonicalName());
   field.addAnnotation(Temporal.class).setEnumValue(type);
   return field;
}
 
开发者ID:forge,项目名称:angularjs-addon,代码行数:10,代码来源:ProjectHelper.java

示例14: visit

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public void visit(Body body) {
    for (AnnotationSource annoSource : body.getAnnotations()) {
        visit(annoSource);
    }
    for (FieldSource fieldSource : body.getFields()) {
        visit(fieldSource);
    }
    for (MethodSource methodSource : body.getMethods()) {
        visit(methodSource);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:12,代码来源:JavaSourceVisitor.java

示例15: visitFields

import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
@Test
public void visitFields() {
    for ( FieldSource fieldSource : javaClassSource.getFields() ) {
        visitor.visit( fieldSource );
    }

    checkVisitor( Arrays.asList( "ref:java => int", "ref:java => java.math.BigDecimal" ) );
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:JavaSourceVisitorTest.java


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