本文整理汇总了Java中com.sun.tools.xjc.outline.FieldOutline类的典型用法代码示例。如果您正苦于以下问题:Java FieldOutline类的具体用法?Java FieldOutline怎么用?Java FieldOutline使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FieldOutline类属于com.sun.tools.xjc.outline包,在下文中一共展示了FieldOutline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIdFieldsOutline
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的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: createPrimaryKeyJoinColumns
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public void createPrimaryKeyJoinColumns(Mapping context,
FieldOutline fieldOutline,
Collection<FieldOutline> idFieldOutlines,
List<PrimaryKeyJoinColumn> primaryKeyJoinColumns) {
final Iterator<PrimaryKeyJoinColumn> joinColumnIterator = new ArrayList<PrimaryKeyJoinColumn>(
primaryKeyJoinColumns).iterator();
for (FieldOutline idFieldOutline : idFieldOutlines) {
final PrimaryKeyJoinColumn joinColumn;
if (joinColumnIterator.hasNext()) {
joinColumn = joinColumnIterator.next();
} else {
joinColumn = new PrimaryKeyJoinColumn();
primaryKeyJoinColumns.add(joinColumn);
}
createPrimaryKeyJoinColumn(context, fieldOutline, idFieldOutline,
joinColumn);
}
}
示例3: createJoinColumns
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public void createJoinColumns(Mapping context, FieldOutline fieldOutline,
Collection<FieldOutline> idFieldOutlines,
List<JoinColumn> joinColumns) {
final Iterator<JoinColumn> joinColumnIterator = new ArrayList<JoinColumn>(
joinColumns).iterator();
for (FieldOutline idFieldOutline : idFieldOutlines) {
final JoinColumn joinColumn;
if (joinColumnIterator.hasNext()) {
joinColumn = joinColumnIterator.next();
} else {
joinColumn = new JoinColumn();
joinColumns.add(joinColumn);
}
createJoinColumn(context, fieldOutline, idFieldOutline, joinColumn);
}
}
示例4: JoinColumn
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
protected void createJoinTable$JoinColumn(Mapping context,
FieldOutline fieldOutline,
Collection<FieldOutline> idFieldOutlines, JoinTable joinTable) {
final Iterator<JoinColumn> joinColumnIterator = new ArrayList<JoinColumn>(
joinTable.getJoinColumn()).iterator();
for (FieldOutline idFieldOutline : idFieldOutlines) {
final JoinColumn joinColumn;
if (joinColumnIterator.hasNext()) {
joinColumn = joinColumnIterator.next();
} else {
joinColumn = new JoinColumn();
joinTable.getJoinColumn().add(joinColumn);
}
createJoinTable$JoinColumn(context, fieldOutline, idFieldOutline,
joinColumn);
}
}
示例5: DefinedClassOutline
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的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());
}
}
}
示例6:
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public void createManyToMany$JoinTable(Mapping context,
FieldOutline fieldOutline, ManyToMany manyToMany) {
final Collection<FieldOutline> sourceIdFieldOutlines = context
.getAssociationMapping().getSourceIdFieldsOutline(context,
fieldOutline);
final Collection<FieldOutline> targetIdFieldOutlines = context
.getAssociationMapping().getTargetIdFieldsOutline(context,
fieldOutline);
// if (sourceIdFieldOutlines.isEmpty()) {
// manyToMany.setJoinTable(null);
// } else
if (manyToMany.getJoinTable() != null) {
context.getAssociationMapping().createJoinTable(context,
fieldOutline, sourceIdFieldOutlines, targetIdFieldOutlines,
manyToMany.getJoinTable());
}
// else {
// // ***
// final JoinTable joinTable = new JoinTable();
// manyToMany.setJoinTable(joinTable);
// context.getAssociationMapping().createJoinTable(context,
// fieldOutline, sourceIdFieldOutlines, targetIdFieldOutlines,
// manyToMany.getJoinTable());
// }
}
示例7: findField
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的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;
}
示例8: discoverDirectClasses
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
/**
* Finds all external class references
* @param outline root of the generated code
* @param classes set of generated classes
* @return set of external classes
* @throws IllegalAccessException throw if there's an error introspecting the annotations
*/
static Set<JClass> discoverDirectClasses(Outline outline, Set<ClassOutline> classes) throws IllegalAccessException {
Set<String> directClassNames = new LinkedHashSet<>();
for(ClassOutline classOutline : classes) {
// for each field, if it's a bean, then visit it
List<FieldOutline> fields = findAllDeclaredAndInheritedFields(classOutline);
for(FieldOutline fieldOutline : fields) {
JType rawType = fieldOutline.getRawType();
CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
boolean isCollection = propertyInfo.isCollection();
if (isCollection) {
JClass collClazz = (JClass) rawType;
JClass collType = collClazz.getTypeParameters().get(0);
addIfDirectClass(directClassNames, collType);
} else {
addIfDirectClass(directClassNames, rawType);
}
parseXmlAnnotations(outline, fieldOutline, directClassNames);
}
}
Set<JClass> direct = directClassNames
.stream()
.map(cn -> outline.getCodeModel().directClass(cn))
.collect(Collectors.toCollection(LinkedHashSet::new));
return direct;
}
示例9: isFieldOutlineEmbeddedId
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public boolean isFieldOutlineEmbeddedId(Mapping context,
FieldOutline fieldOutline) {
final Collection<? extends CTypeInfo> types = context.getGetTypes()
.process(context, fieldOutline.getPropertyInfo());
assert types.size() == 1;
final CTypeInfo type = types.iterator().next();
return (type instanceof CClass && CustomizationUtils
.containsCustomization(fieldOutline,
Customizations.EMBEDDED_ID_ELEMENT_NAME));
}
示例10: getFields
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public static FieldOutline[] getFields(ClassOutline classOutline) {
final List<FieldOutline> fields = new ArrayList<FieldOutline>();
fields.addAll(Arrays.asList(classOutline.getDeclaredFields()));
if (classOutline.getSuperClass() != null) {
fields.addAll(Arrays
.asList(getFields(classOutline.getSuperClass())));
}
return fields.toArray(new FieldOutline[fields.size()]);
}
示例11: markAsAcknowledged
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public void markAsAcknowledged(ClassOutline classOutline) {
Customizations.markAsAcknowledged(classOutline.target);
for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) {
Customizations.markAsAcknowledged(fieldOutline.getPropertyInfo());
}
}
示例12: findCustomization
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public static CPluginCustomization findCustomization(FieldOutline fieldOutline, QName name) {
final CCustomizations customizations = CustomizationUtils.getCustomizations(fieldOutline);
final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
if (customization != null) {
customization.markAsAcknowledged();
}
return customization;
}
示例13: run
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的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;
}
示例14: createColumn
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
public final Column createColumn(Mapping context,
FieldOutline fieldOutline, Column column) {
if (column == null) {
column = new Column();
}
if (column.getName() == null || "##default".equals(column.getName())) {
column.setName(context.getNaming().getColumn$Name(context,
fieldOutline));
}
assignColumn$LengthPrecisionScale(fieldOutline, column);
return column;
}
示例15: generateField
import com.sun.tools.xjc.outline.FieldOutline; //导入依赖的package包/类
@Override
protected FieldOutline generateField(final ProcessModel context,CPropertyInfo core,
ClassOutlineImpl classOutline, CPropertyInfo propertyInfo) {
final SingleWrappingField fieldOutline = new SingleWrappingField(classOutline, propertyInfo, core);
fieldOutline.generateAccessors();
return fieldOutline;
}