本文整理汇总了Java中org.jboss.forge.roaster.model.source.FieldSource类的典型用法代码示例。如果您正苦于以下问题:Java FieldSource类的具体用法?Java FieldSource怎么用?Java FieldSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldSource类属于org.jboss.forge.roaster.model.source包,在下文中一共展示了FieldSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: addProperty
import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private ObjectProperty addProperty(DataObject dataObject,
FieldSource<JavaClassSource> field,
ClassTypeResolver classTypeResolver) throws ModelDriverException {
ObjectProperty property = parseProperty(field,
classTypeResolver);
dataObject.addProperty(property);
return property;
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:9,代码来源:JavaRoasterModelDriver.java
示例17: hasChangedToCollectionType
import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
private boolean hasChangedToCollectionType(FieldSource<JavaClassSource> field,
ObjectProperty property,
ClassTypeResolver classTypeResolver) throws Exception {
return DriverUtils.isManagedType(field.getType(),
classTypeResolver)
&& !DriverUtils.equalsType(field.getType(),
property.getClassName(),
property.isMultiple(),
property.getBag(),
classTypeResolver) &&
property.isMultiple();
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:14,代码来源:JavaRoasterModelDriver.java
示例18: removeField
import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
/**
* Takes care of field and the corresponding setter/getter removal.
*/
public void removeField(JavaClassSource javaClassSource,
String fieldName,
ClassTypeResolver classTypeResolver) throws Exception {
logger.debug("Removing field: " + fieldName + ", from class: " + javaClassSource.getName());
FieldSource<JavaClassSource> field;
GenerationTools genTools = new GenerationTools();
String methodName;
field = javaClassSource.getField(fieldName);
if (field != null) {
//check if the class has a setter/getter for the given field.
Class<?> fieldClass = classTypeResolver.resolveType(field.getType().getName());
methodName = genTools.toJavaGetter(fieldName,
fieldClass.getName());
removeMethodByParamsClass(javaClassSource,
methodName);
methodName = genTools.toJavaSetter(fieldName);
removeMethodByParamsClass(javaClassSource,
methodName,
fieldClass);
//finally remove the field.
javaClassSource.removeField(field);
} else {
logger.debug("Field field: " + fieldName + " was not found in class: " + javaClassSource.getName());
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:34,代码来源:JavaRoasterModelDriver.java
示例19: isManagedField
import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public boolean isManagedField(FieldSource<JavaClassSource> field,
ClassTypeResolver classTypeResolver) throws Exception {
if (!field.isFinal() && !field.isStatic()) {
//finally we can check if the field type is a managed type.
//if not, the field should remain untouched
return DriverUtils.isManagedType(field.getType(),
classTypeResolver);
}
return false;
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:12,代码来源:JavaRoasterModelDriver.java
示例20: setPrimitiveTypeDefaultInitializer
import org.jboss.forge.roaster.model.source.FieldSource; //导入依赖的package包/类
public void setPrimitiveTypeDefaultInitializer(FieldSource<?> field,
String primitiveType) {
if (NamingUtils.BYTE.equals(primitiveType)) {
field.setLiteralInitializer("0");
}
if (NamingUtils.SHORT.equals(primitiveType)) {
field.setLiteralInitializer("0");
}
if (NamingUtils.INT.equals(primitiveType)) {
field.setLiteralInitializer("0");
}
if (NamingUtils.LONG.equals(primitiveType)) {
field.setLiteralInitializer("0L");
}
if (NamingUtils.FLOAT.equals(primitiveType)) {
field.setLiteralInitializer("0.0f");
}
if (NamingUtils.DOUBLE.equals(primitiveType)) {
field.setLiteralInitializer("0.0d");
}
if (NamingUtils.CHAR.equals(primitiveType)) {
field.setLiteralInitializer("\'\\u0000\'");
}
if (NamingUtils.BOOLEAN.equals(primitiveType)) {
field.setLiteralInitializer("false");
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:29,代码来源:JavaRoasterModelDriver.java
注:本文中的org.jboss.forge.roaster.model.source.FieldSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论