本文整理汇总了Java中com.sun.tools.xjc.outline.Outline.getClazz方法的典型用法代码示例。如果您正苦于以下问题:Java Outline.getClazz方法的具体用法?Java Outline.getClazz怎么用?Java Outline.getClazz使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.xjc.outline.Outline
的用法示例。
在下文中一共展示了Outline.getClazz方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws Exception {
PluginImpl clonePlugin = new PluginImpl();
clonePlugin.run(outline, opt, errorHandler);
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
if (isPrism(classOutline)) {
removeConstructors(classOutline);
removeCloneableMethod(classOutline);
removePrivateStaticCopyMethods(classOutline);
createCloneMethod(classOutline);
}
}
return true;
}
示例2: removeCustomGeneratedMethod
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
/**
* remove generated equals methods from classes which extends from prism containers/objects
*/
private void removeCustomGeneratedMethod(Outline outline) {
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = getCClassInfoQName(entry.getValue());
if (qname == null || (!hasParentAnnotation(classOutline, A_PRISM_OBJECT)
&& !hasParentAnnotation(classOutline, A_PRISM_CONTAINER))) {
continue;
}
JDefinedClass definedClass = classOutline.implClass;
Iterator<JClass> iterator = definedClass._implements();
while (iterator.hasNext()) {
JClass clazz = iterator.next();
if (clazz.equals(CLASS_MAP.get(Equals.class)) || clazz.equals(CLASS_MAP.get(HashCode.class))) {
iterator.remove();
}
}
boolean isMidpointContainer = hasParentAnnotation(classOutline, A_PRISM_OBJECT);
removeOldCustomGeneratedEquals(classOutline, isMidpointContainer);
removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_HASH_CODE);
removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_TO_STRING);
}
}
示例3: addComplextType
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void addComplextType(Outline outline, Map<String, JFieldVar> namespaceFields) {
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = entry.getValue().getTypeName();
if (qname == null) {
continue;
}
JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
if (var != null) {
createQNameDefinition(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, var, qname);
} else {
createPSFField(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, qname);
}
}
}
示例4: findClassOutline
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
public static ClassOutline findClassOutline(Outline outline, QName type) {
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = entry.getValue().getTypeName();
if (!type.equals(qname)) {
continue;
}
return classOutline;
}
throw new IllegalStateException("Object type class defined by qname '" + type + "' outline was not found.");
}
示例5: updateFields
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void updateFields(Outline outline) {
Map<JDefinedClass, List<JFieldVar>> allFieldsToBeRemoved = new HashMap<>();
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
JDefinedClass implClass = classOutline.implClass;
Map<String, JFieldVar> fields = implClass.fields();
if (fields == null) {
continue;
}
print("Updating fields and get/set methods: " + classOutline.implClass.fullName());
for (String field : fields.keySet()) {
JFieldVar fieldVar = fields.get(field);
// marks a:rawType fields with @Raw - this has to be executed for any bean, not only for prism containers
if (hasAnnotation(classOutline, fieldVar, A_RAW_TYPE) != null) {
annotateFieldAsRaw(fieldVar);
}
}
if (isContainer(classOutline.implClass, outline)) {
processContainerFields(classOutline, allFieldsToBeRemoved);
}
createFluentFieldMethods(classOutline, classOutline);
print("Finished updating fields and get/set methods for " + classOutline.implClass.fullName());
}
allFieldsToBeRemoved.forEach((jDefinedClass, jFieldVars) -> {
jFieldVars.forEach(field -> jDefinedClass.removeField(field));
});
}
示例6: updateObjectReferenceType
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void updateObjectReferenceType(Outline outline) {
ClassOutline objectReferenceOutline = null;
for (Map.Entry<NClass, CClassInfo> entry : outline.getModel().beans().entrySet()) {
QName qname = entry.getValue().getTypeName();
if (qname == null || !OBJECT_REFERENCE_TYPE.equals(qname)) {
continue;
}
objectReferenceOutline = outline.getClazz(entry.getValue());
break;
}
if (objectReferenceOutline == null) {
//object reference type class not found
return;
}
updateClassAnnotation(objectReferenceOutline);
JDefinedClass definedClass = objectReferenceOutline.implClass;
definedClass._implements(CLASS_MAP.get(Referencable.class));
createDefaultConstructor(definedClass);
//add prism reference and get/set method for it
JVar reference = definedClass.field(JMod.PRIVATE, PrismReferenceValue.class, REFERENCE_VALUE_FIELD_NAME);
JMethod getReference = definedClass.method(JMod.PUBLIC, PrismReferenceValue.class, METHOD_AS_REFERENCE_VALUE);
// getReference.annotate(CLASS_MAP.get(XmlTransient.class));
JBlock body = getReference.body();
JBlock then = body._if(reference.eq(JExpr._null()))._then();
JInvocation newReference = JExpr._new(CLASS_MAP.get(PrismReferenceValue.class));
then.assign(reference, newReference);
body._return(reference);
JMethod setReference = definedClass.method(JMod.PUBLIC, void.class, METHOD_SETUP_REFERENCE_VALUE);
JVar value = setReference.param(PrismReferenceValue.class, "value");
body = setReference.body();
body.assign(reference, value);
//update for oid methods
updateObjectReferenceOid(definedClass, getReference);
//update for type methods
updateObjectReferenceType(definedClass, getReference);
updateObjectReferenceRelation(definedClass, getReference);
updateObjectReferenceDescription(definedClass, getReference);
updateObjectReferenceFilter(definedClass, getReference);
updateObjectReferenceResolutionTime(definedClass, getReference);
createReferenceFluentEnd(objectReferenceOutline);
}
示例7: updatePrismContainer
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private Set<JDefinedClass> updatePrismContainer(Outline outline) {
Set<JDefinedClass> containers = new HashSet<JDefinedClass>();
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = getCClassInfoQName(entry.getValue());
if (qname == null || !hasAnnotation(classOutline, A_PRISM_CONTAINER)) {
continue;
}
if (hasAnnotation(classOutline, A_PRISM_OBJECT) && hasAnnotation(classOutline, A_PRISM_CONTAINER)) {
continue;
}
JDefinedClass definedClass = classOutline.implClass;
definedClass._implements(CLASS_MAP.get(Containerable.class));
containers.add(definedClass);
//inserting MidPointObject field into ObjectType class
JVar containerValue = definedClass.field(JMod.PRIVATE, PrismContainerValue.class, CONTAINER_VALUE_FIELD_NAME);
// default constructor
createDefaultConstructor(definedClass);
//create asPrismContainer
// createAsPrismContainer(classOutline, containerValue);
createAsPrismContainerValue(definedClass, containerValue);
//create setContainer
JMethod setupContainerMethod = createSetContainerValueMethod(definedClass, containerValue);
// constructor with prismContext
createPrismContextContainerableConstructor(definedClass, setupContainerMethod);
//create toString, equals, hashCode
createToStringMethod(definedClass, METHOD_AS_PRISM_CONTAINER_VALUE);
createEqualsMethod(classOutline, METHOD_AS_PRISM_CONTAINER_VALUE);
createHashCodeMethod(definedClass, METHOD_AS_PRISM_CONTAINER_VALUE);
//get container type
JMethod getContainerType = definedClass.method(JMod.NONE, QName.class, METHOD_GET_CONTAINER_TYPE);
// getContainerType.annotate(CLASS_MAP.get(XmlTransient.class));
JBlock body = getContainerType.body();
body._return(definedClass.staticRef(COMPLEX_TYPE_FIELD_NAME));
}
removeCustomGeneratedMethod(outline);
return containers;
}
示例8: updatePrismObject
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private Set<JDefinedClass> updatePrismObject(Outline outline) {
Set<JDefinedClass> containers = new HashSet<JDefinedClass>();
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = getCClassInfoQName(entry.getValue());
if (qname == null) {
continue;
}
boolean isDirectPrismObject = hasAnnotation(classOutline, A_PRISM_OBJECT);
boolean isIndirectPrismObject = hasParentAnnotation(classOutline, A_PRISM_OBJECT);
if (!isIndirectPrismObject) {
continue;
}
JDefinedClass definedClass = classOutline.implClass;
createDefaultConstructor(definedClass);
createPrismContextObjectableConstructor(definedClass);
createAsPrismObject(definedClass);
if (!isDirectPrismObject) {
continue;
}
definedClass._implements(CLASS_MAP.get(Objectable.class));
containers.add(definedClass);
//inserting PrismObject field into ObjectType class
JVar container = definedClass.field(JMod.PRIVATE, PrismObject.class, CONTAINER_FIELD_NAME);
//create getContainer
// createGetContainerMethod(classOutline, container);
//create setContainer
createSetContainerMethod(definedClass, container);
//create asPrismObject()
createAsPrismContainer(classOutline, container);
// Objectable is also Containerable, we also need these
createAsPrismContainerValueInObject(definedClass);
createSetContainerValueMethodInObject(definedClass, container);
print("Creating toString, equals, hashCode methods.");
//create toString, equals, hashCode
createToStringMethod(definedClass, METHOD_AS_PRISM_CONTAINER);
createEqualsMethod(classOutline, METHOD_AS_PRISM_CONTAINER);
createHashCodeMethod(definedClass, METHOD_AS_PRISM_CONTAINER);
//create toDebugName, toDebugType
createToDebugName(definedClass);
createToDebugType(definedClass);
}
removeCustomGeneratedMethod(outline);
return containers;
}
示例9: addContainerName
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void addContainerName(Outline outline, Map<String, JFieldVar> namespaceFields) {
Map<QName, List<QName>> complexTypeToElementName = null;
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
CClassInfo classInfo = entry.getValue();
ClassOutline classOutline = outline.getClazz(classInfo);
if (complexTypeToElementName == null) {
complexTypeToElementName = getComplexTypeToElementName(classOutline);
}
QName qname = getCClassInfoQName(classInfo);
if (qname == null || !hasParentAnnotation(classOutline, A_PRISM_OBJECT)) {
continue;
}
//element name
List<QName> qnames = complexTypeToElementName.get(qname);
if (qnames == null || qnames.size() != 1) {
printWarning("Found zero or more than one element names for type '"
+ qname + "', " + qnames + ".");
continue;
}
qname = qnames.get(0);
JDefinedClass definedClass = classOutline.implClass;
JMethod getContainerName = definedClass.method(JMod.NONE, QName.class, METHOD_GET_CONTAINER_NAME);
// getContainerName.annotate(CLASS_MAP.get(XmlTransient.class));
JBlock body = getContainerName.body();
JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
JInvocation invocation = JExpr._new(CLASS_MAP.get(QName.class));
if (var != null) {
JClass schemaClass = outline.getModel().codeModel._getClass(StepSchemaConstants.CLASS_NAME);
invocation.arg(schemaClass.staticRef(var));
invocation.arg(qname.getLocalPart());
} else {
invocation.arg(qname.getNamespaceURI());
invocation.arg(qname.getLocalPart());
}
body._return(invocation);
//get container type
JMethod getContainerType = definedClass.method(JMod.NONE, QName.class, METHOD_GET_CONTAINER_TYPE);
// getContainerType.annotate(CLASS_MAP.get(XmlTransient.class));
body = getContainerType.body();
body._return(definedClass.staticRef(COMPLEX_TYPE_FIELD_NAME));
}
}
示例10: addFieldQNames
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void addFieldQNames(Outline outline, Map<String, JFieldVar> namespaceFields) {
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = getCClassInfoQName(entry.getValue());
if (qname == null) {
continue;
}
JDefinedClass implClass = classOutline.implClass;
Map<String, JFieldVar> fields = implClass.fields();
if (fields == null) {
continue;
}
boolean isObject = hasAnnotation(classOutline, A_PRISM_OBJECT);
List<FieldBox<QName>> boxes = new ArrayList<FieldBox<QName>>();
for (Entry<String, JFieldVar> fieldEntry : fields.entrySet()) {
String field = normalizeFieldName(fieldEntry.getKey());
if ((isObject && ("oid".equals(field) || "version".equals(field)) ||
"serialVersionUID".equals(field) || "id".equals(field) || COMPLEX_TYPE_FIELD_NAME.equals(field))) {
continue;
}
if (hasAnnotationClass(fieldEntry.getValue(), XmlAnyElement.class)) {
continue;
}
String fieldName = fieldFPrefixUnderscoredUpperCase(field);
boxes.add(new FieldBox<>(fieldName, new QName(qname.getNamespaceURI(), field)));
}
for (FieldBox<QName> box : boxes) {
JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
if (var != null) {
createQNameDefinition(outline, implClass, box.getFieldName(), var, box.getValue());
} else {
createPSFField(outline, implClass, box.getFieldName(), box.getValue());
}
}
}
}
示例11: run
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
@Override
public boolean run(Outline outline, Options options) throws Exception {
final Ring ring = Ring.begin();
try {
Ring.add(this.bgmBuilder);
Ring.add(outline.getModel());
final ModelAndOutlineProcessor<EjbPlugin> modelAndOutlineProcessor = getModelAndOutlineProcessor();
modelAndOutlineProcessor.process(this, outline.getModel(), options);
} catch (Exception ex) {
ex.printStackTrace();
throw ex;
} finally {
Ring.end(ring);
}
for (final CClassInfo classInfo : getCreatedClasses()) {
final ClassOutline classOutline = outline.getClazz(classInfo);
if (Customizations.isGenerated(classInfo)) {
generateClassBody(outline, (ClassOutlineImpl) classOutline);
}
for (final CPropertyInfo propertyInfo : classInfo.getProperties()) {
if (outline.getField(propertyInfo) == null) {
generateFieldDecl(outline, (ClassOutlineImpl) classOutline,
propertyInfo);
}
}
}
/*
* final Ring ring = Ring.begin(); try {
*
* final ErrorReceiverFilter ef = new
* ErrorReceiverFilter(outline.getErrorReceiver());
*
* Ring.add(XSSchemaSet.class,outline.getModel().schemaComponent);
* Ring.add(outline.getModel()); Ring.add(outline.getCodeModel());
* Ring.add(ErrorReceiver.class,ef);
* Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef));
*
* final Class<BGMBuilder> theClass = BGMBuilder.class; Constructor<?>
* constructor = theClass.getDeclaredConstructors()[0];
* constructor.setAccessible(true); constructor.newInstance(new Object[]
* { "a", "b", true, new FieldRendererFactory() });
*/
modelAndOutlineProcessor.process(this, outline, options);
generateRoundtripTestClass(outline);
checkCustomizations(outline);
return true;
/*
* } finally { Ring.end(ring); }
*/
}
示例12: updateObjectReferenceType
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void updateObjectReferenceType(Outline outline) {
ClassOutline objectReferenceOutline = null;
for (Map.Entry<NClass, CClassInfo> entry : outline.getModel().beans().entrySet()) {
QName qname = entry.getValue().getTypeName();
if (qname == null || !OBJECT_REFERENCE_TYPE.equals(qname)) {
continue;
}
objectReferenceOutline = outline.getClazz(entry.getValue());
break;
}
if (objectReferenceOutline == null) {
//object reference type class not found
return;
}
updateClassAnnotation(objectReferenceOutline);
JDefinedClass definedClass = objectReferenceOutline.implClass;
definedClass._implements(CLASS_MAP.get(Referencable.class));
createDefaultConstructor(definedClass);
//add prism reference and get/set method for it
JVar reference = definedClass.field(JMod.PRIVATE, PrismReferenceValue.class, REFERENCE_VALUE_FIELD_NAME);
JMethod getReference = definedClass.method(JMod.PUBLIC, PrismReferenceValue.class, METHOD_AS_REFERENCE_VALUE);
// getReference.annotate(CLASS_MAP.get(XmlTransient.class));
JBlock body = getReference.body();
JBlock then = body._if(reference.eq(JExpr._null()))._then();
JInvocation newReference = JExpr._new(CLASS_MAP.get(PrismReferenceValue.class));
then.assign(reference, newReference);
body._return(reference);
JMethod setReference = definedClass.method(JMod.PUBLIC, definedClass, METHOD_SETUP_REFERENCE_VALUE);
JVar value = setReference.param(PrismReferenceValue.class, "value");
body = setReference.body();
body.assign(reference, value);
body._return(JExpr._this());
//update for oid methods
updateObjectReferenceOid(definedClass, getReference);
//update for type methods
updateObjectReferenceType(definedClass, getReference);
updateObjectReferenceRelation(definedClass, getReference);
updateObjectReferenceDescription(definedClass, getReference);
updateObjectReferenceFilter(definedClass, getReference);
updateObjectReferenceResolutionTime(definedClass, getReference);
createReferenceFluentEnd(objectReferenceOutline);
}
示例13: addFieldQNames
import com.sun.tools.xjc.outline.Outline; //导入方法依赖的package包/类
private void addFieldQNames(Outline outline, Map<String, JFieldVar> namespaceFields) {
Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
for (Map.Entry<NClass, CClassInfo> entry : set) {
ClassOutline classOutline = outline.getClazz(entry.getValue());
QName qname = getCClassInfoQName(entry.getValue());
if (qname == null) {
continue;
}
JDefinedClass implClass = classOutline.implClass;
Map<String, JFieldVar> fields = implClass.fields();
if (fields == null) {
continue;
}
boolean isObject = hasAnnotation(classOutline, A_PRISM_OBJECT);
List<FieldBox<QName>> boxes = new ArrayList<FieldBox<QName>>();
for (Entry<String, JFieldVar> fieldEntry : fields.entrySet()) {
String field = normalizeFieldName(fieldEntry.getKey());
if ((isObject && ("oid".equals(field) || "version".equals(field)) ||
"serialVersionUID".equals(field) || "id".equals(field) || COMPLEX_TYPE_FIELD_NAME.equals(field))) {
continue;
}
if (hasAnnotationClass(fieldEntry.getValue(), XmlAnyElement.class)) {
continue;
}
String fieldName = fieldFPrefixUnderscoredUpperCase(field);
boxes.add(new FieldBox<>(fieldName, new QName(qname.getNamespaceURI(), field)));
}
for (FieldBox<QName> box : boxes) {
JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
if (var != null) {
createQNameDefinition(outline, implClass, box.getFieldName(), var, box.getValue());
} else {
createPSFField(outline, implClass, box.getFieldName(), box.getValue());
}
}
}
}