本文整理汇总了Java中com.sun.tools.xjc.outline.ClassOutline.getDeclaredFields方法的典型用法代码示例。如果您正苦于以下问题:Java ClassOutline.getDeclaredFields方法的具体用法?Java ClassOutline.getDeclaredFields怎么用?Java ClassOutline.getDeclaredFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.xjc.outline.ClassOutline
的用法示例。
在下文中一共展示了ClassOutline.getDeclaredFields方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdFieldsOutline
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
private Collection<FieldOutline> getIdFieldsOutline(
final ClassOutline classOutline) {
final Collection<FieldOutline> idFieldOutlines = new ArrayList<FieldOutline>();
ClassOutline current = classOutline;
while (current != null) {
for (FieldOutline idFieldOutline : current.getDeclaredFields()) {
final CPropertyInfo propertyInfo = idFieldOutline
.getPropertyInfo();
if ((CustomizationUtils.containsCustomization(propertyInfo,
Customizations.ID_ELEMENT_NAME) || CustomizationUtils
.containsCustomization(propertyInfo,
Customizations.EMBEDDED_ID_ELEMENT_NAME))
&& !CustomizationUtils.containsCustomization(
propertyInfo,
Customizations.IGNORED_ELEMENT_NAME)) {
idFieldOutlines.add(idFieldOutline);
}
}
current = current.getSuperClass();
}
return idFieldOutlines;
}
示例2: process
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public EmbeddableAttributes process(Mapping context,
ClassOutline classOutline, Options options) {
final EmbeddableAttributes attributes = new EmbeddableAttributes();
final FieldOutline[] fieldOutlines = classOutline.getDeclaredFields();
for (final FieldOutline fieldOutline : fieldOutlines) {
final Object attributeMapping = getAttributeMapping(context,
fieldOutline, options).process(context, fieldOutline,
options);
if (attributeMapping instanceof Basic) {
attributes.getBasic().add((Basic) attributeMapping);
} else if (attributeMapping instanceof Transient) {
attributes.getTransient().add((Transient) attributeMapping);
}
}
return attributes;
}
示例3: DefinedClassOutline
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public DefinedClassOutline(final PluginContext pluginContext, final ClassOutline classOutline) {
this.pluginContext = pluginContext;
this.classOutline = classOutline;
final List<DefinedPropertyOutline> properties = new ArrayList<>(classOutline.getDeclaredFields().length);
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
properties.add(new DefinedPropertyOutline(fieldOutline));
}
this.declaredFields = Collections.unmodifiableList(properties);
if (this.classOutline.getSuperClass() != null) {
this.superClass = new DefinedClassOutline(this.pluginContext, this.classOutline.getSuperClass());
} else {
try {
final Class<?> ungeneratedSuperClass = Class.forName(this.classOutline.implClass._extends().fullName());
if (Object.class.equals(ungeneratedSuperClass)) {
this.superClass = null;
} else {
this.superClass = new ReferencedClassOutline(this.pluginContext.codeModel, ungeneratedSuperClass);
}
} catch (final Exception e) {
throw new RuntimeException("Cannot find superclass of " + this.classOutline.target.getName() + ": " + this.classOutline.target.getLocator());
}
}
}
示例4: generateMetaClass
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
private void generateMetaClass(final PluginContext pluginContext, final ClassOutline classOutline, final ErrorHandler errorHandler) throws SAXException {
try {
final JDefinedClass metaClass = classOutline.implClass._class(JMod.PUBLIC | JMod.STATIC, this.metaClassName);
final JMethod visitMethod = generateVisitMethod(classOutline);
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
if (this.extended) {
generateExtendedMetaField(pluginContext, metaClass, visitMethod, fieldOutline);
} else {
generateNameOnlyMetaField(pluginContext, metaClass, fieldOutline);
}
}
visitMethod.body()._return(JExpr._this());
} catch (final JClassAlreadyExistsException e) {
errorHandler.error(new SAXParseException(getMessage("error.metaClassExists", classOutline.implClass.name(), this.metaClassName), classOutline.target.getLocator()));
}
}
示例5: findFieldWithCustomization
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public static FieldOutline findFieldWithCustomization(ClassOutline classOutline, final QName name) {
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
final CCustomizations customizations = getCustomizations(fieldOutline);
final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
if (customization != null)
return fieldOutline;
}
return null;
}
示例6: findInheritedFieldWithCustomization
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public static FieldOutline findInheritedFieldWithCustomization(ClassOutline classOutline, final QName name) {
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
if (containsCustomization(fieldOutline, name)) {
return fieldOutline;
}
}
final ClassOutline superClassOutline = classOutline.getSuperClass();
if (superClassOutline != null) {
return findInheritedFieldWithCustomization(superClassOutline, name);
} else {
return null;
}
}
示例7: run
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler)
throws SAXException {
try {
DummyListField_$get = new FieldAccessor<JMethod>(
DummyListField.class, "$get", JMethod.class);
IsSetField_core = new FieldAccessor<FieldOutline>(IsSetField.class,
"core", FieldOutline.class);
AbstractListField_field = new FieldAccessor<JFieldVar>(
DummyListField.class.getSuperclass(), "field",
JFieldVar.class);
AbstractListField_listT = new FieldAccessor<JClass>(
DummyListField.class.getSuperclass(), "listT", JClass.class);
DummyListField_coreList = new FieldAccessor<JClass>(
DummyListField.class, "coreList",
JClass.class);
} catch (Exception ex) {
throw new SAXException("Could not create field accessors. "
+ "This plugin can not be used in this environment.", ex);
}
for (ClassOutline classOutline : outline.getClasses()) {
for (FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
fixFieldOutline(fieldOutline);
}
}
return false;
}
示例8: markAsAcknowledged
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public void markAsAcknowledged(ClassOutline classOutline) {
Customizations.markAsAcknowledged(classOutline.target);
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
Customizations.markAsAcknowledged(fieldOutline.getPropertyInfo());
}
}
示例9: findField
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
private FieldOutline findField(final ClassOutline implClass, final PropertyUse propertyUse) throws SAXException {
if (!propertyUse.isFixed()) {
for (final FieldOutline field : implClass.getDeclaredFields()) {
if (field.getPropertyInfo().getName(true).equals(propertyUse.getName())) {
return field;
}
}
this.pluginContext.errorHandler.error(new SAXParseException(MessageFormat.format(GroupInterfaceGenerator.RESOURCE_BUNDLE.getString("error.property-not-found"), propertyUse.declaration.toString(), propertyUse.getName(), implClass.implClass.fullName()), propertyUse.declaration.getLocator()));
}
return null;
}
示例10: processClassOutline
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
protected void processClassOutline(ClassOutline classOutline,
Options options, ErrorHandler errorHandler) {
final CCustomizations customizations = CustomizationUtils
.getCustomizations(classOutline);
annotateClassOutline(classOutline.ref.owner(), classOutline,
customizations, errorHandler);
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
processFieldOutline(classOutline, fieldOutline, options,
errorHandler);
}
}
示例11: process
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
public Attributes process(Mapping context, ClassOutline classOutline,
Options options) {
final Attributes attributes = new Attributes();
final FieldOutline[] fieldOutlines = classOutline.getDeclaredFields();
for (final FieldOutline fieldOutline : fieldOutlines) {
final Object attributeMapping = getAttributeMapping(context,
fieldOutline, options).process(context, fieldOutline,
options);
if (attributeMapping instanceof Id) {
if (attributes.getEmbeddedId() == null) {
attributes.getId().add((Id) attributeMapping);
} else {
logger.error("Could not add an id element to the attributes of the class ["
+
fieldOutline.parent().target.getName()
+ "] because they already contain an embedded-id element.");
}
} else if (attributeMapping instanceof EmbeddedId) {
if (!attributes.getId().isEmpty()) {
logger.error("Could not add an embedded-id element to the attributes of the class ["
+
fieldOutline.parent().target.getName()
+ "] because they already contain an id element.");
} else if (attributes.getEmbeddedId() != null) {
logger.error("Could not add an embedded-id element to the attributes of the class ["
+
fieldOutline.parent().target.getName()
+ "] because they already contain an embedded-id element.");
} else {
attributes.setEmbeddedId((EmbeddedId) attributeMapping);
}
} else if (attributeMapping instanceof Basic) {
attributes.getBasic().add((Basic) attributeMapping);
} else if (attributeMapping instanceof Version) {
attributes.getVersion().add((Version) attributeMapping);
} else if (attributeMapping instanceof ManyToOne) {
attributes.getManyToOne().add((ManyToOne) attributeMapping);
} else if (attributeMapping instanceof OneToMany) {
attributes.getOneToMany().add((OneToMany) attributeMapping);
} else if (attributeMapping instanceof OneToOne) {
attributes.getOneToOne().add((OneToOne) attributeMapping);
} else if (attributeMapping instanceof ManyToMany) {
attributes.getManyToMany().add((ManyToMany) attributeMapping);
} else if (attributeMapping instanceof ElementCollection) {
attributes.getElementCollection().add(
(ElementCollection) attributeMapping);
} else if (attributeMapping instanceof Embedded) {
attributes.getEmbedded().add((Embedded) attributeMapping);
} else if (attributeMapping instanceof Transient) {
attributes.getTransient().add((Transient) attributeMapping);
}
}
return attributes;
}
示例12: getFields
import com.sun.tools.xjc.outline.ClassOutline; //导入方法依赖的package包/类
private static List<FieldInfo> getFields(CGConfig cgConfig, ClassOutline co) {
List<FieldInfo> fields = new ArrayList<>();
for (FieldOutline fo : co.getDeclaredFields()) {
FieldInfo fieldInfo = new FieldInfo();
// field name
ClientModule clientModule = cgConfig.module.getClientModule();
fieldInfo.setName(clientModule.generateSafeName(fo.getPropertyInfo().getName(false)));
fieldInfo.setInitialName(fo.getPropertyInfo().getName(false));
fieldInfo.setRequired(isRequired(fo));
JType rawType = fo.getRawType();
TypeInfo typeInfo = buildTypeInfo(rawType);
if (rawType.isArray()) {
typeInfo.setArray(true);
typeInfo.setElementType(buildTypeInfo(rawType.elementType())); // T of T[]
}
typeInfo.getTypeParameters().addAll(getTypeParameters(rawType));
fieldInfo.setType(typeInfo);
// schema kind
CPropertyInfo cProp = fo.getPropertyInfo();
fieldInfo.setPropertyKindElement(cProp.kind() == PropertyKind.ELEMENT);
fieldInfo.setPropertyKindAttribute(cProp.kind() == PropertyKind.ATTRIBUTE);
fieldInfo.setPropertyKindValue(cProp.kind() == PropertyKind.VALUE);
fieldInfo.setPropertyKindAny(cProp.kind() == PropertyKind.REFERENCE);
setAnnotation(co, fieldInfo, cProp);
fieldInfo.getType().setCollection(cProp.isCollection());
setDocComment(fo, fieldInfo);
if (fieldInfo.isRequired() && fieldInfo.getType().isCollection()) {
System.out.println("min occurs : 1 " + co.implClass.name() + "." + fieldInfo.getInitialName());
}
fields.add(fieldInfo);
}
return fields;
}