本文整理汇总了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));
});
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
}
}
}
示例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"));
}
示例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);
}
}
示例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());
}
示例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;
}
示例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");
}
}
示例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;
}
示例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);
}
}
示例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" ) );
}