本文整理汇总了Java中com.sun.tools.xjc.model.CElementInfo类的典型用法代码示例。如果您正苦于以下问题:Java CElementInfo类的具体用法?Java CElementInfo怎么用?Java CElementInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CElementInfo类属于com.sun.tools.xjc.model包,在下文中一共展示了CElementInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getContainer
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
private MContainer getContainer(CClassInfoParent parent) {
return parent.accept(new Visitor<MContainer>() {
public MContainer onBean(CClassInfo bean) {
return getTypeInfo(bean);
}
public MContainer onPackage(JPackage pkg) {
return getPackage(pkg);
}
public MContainer onElement(CElementInfo element) {
return getElementInfo(element);
}
});
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:17,代码来源:XJCCMInfoFactory.java
示例2: getPackage
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
private MPackageInfo getPackage(CClassInfoParent parent) {
return parent.accept(new Visitor<MPackageInfo>() {
public MPackageInfo onBean(CClassInfo bean) {
return getPackage(bean.parent());
}
public MPackageInfo onPackage(JPackage pkg) {
return getPackage(pkg);
}
public MPackageInfo onElement(CElementInfo element) {
return getPackage(element.parent);
}
});
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:19,代码来源:XJCCMInfoFactory.java
示例3: getPossibleTypes
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public static Set<JType> getPossibleTypes(Outline outline, Aspect aspect,
CTypeInfo typeInfo) {
final Set<JType> types = new HashSet<JType>();
types.add(typeInfo.getType().toType(outline, aspect));
if (typeInfo instanceof CElementInfo) {
final CElementInfo elementInfo = (CElementInfo) typeInfo;
for (CElementInfo substitutionMember : elementInfo
.getSubstitutionMembers()) {
types.addAll(getPossibleTypes(outline, aspect,
substitutionMember));
}
}
return types;
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:18,代码来源:FieldUtils.java
示例4: run
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
for (final ClassOutline classOutline : outline.getClasses()) {
if (classOutline.target.getElementName() != null) {
processGlobalElement(classOutline);
} else {
processGlobalComplexType(classOutline);
}
}
for (final CElementInfo elementInfo : outline.getModel()
.getAllElements()) {
final ElementOutline elementOutline = outline
.getElement(elementInfo);
if (elementOutline != null) {
processGlobalJAXBElement(elementOutline);
}
}
return true;
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:20,代码来源:AutoInheritancePlugin.java
示例5: getTypeUse
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public static TypeUse getTypeUse(ProcessModel processModel,
CPropertyInfo propertyInfo) {
if (propertyInfo instanceof CValuePropertyInfo) {
return ((CValuePropertyInfo) propertyInfo).getTarget();
} else if (propertyInfo instanceof CAttributePropertyInfo) {
return ((CAttributePropertyInfo) propertyInfo).getTarget();
} else {
final CTypeInfo type = propertyInfo.ref().iterator().next();
if (type instanceof CBuiltinLeafInfo) {
if (propertyInfo.getAdapter() != null) {
return TypeUseFactory.adapt((CBuiltinLeafInfo) type,
propertyInfo.getAdapter());
} else {
return (CBuiltinLeafInfo) type;
}
} else if (type instanceof CElementInfo) {
final CElementInfo elementInfo = (CElementInfo) type;
return getTypeUse(processModel, elementInfo.getProperty());
} else {
throw new AssertionError("Unexpected type.");
}
}
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:25,代码来源:TypeUseUtils.java
示例6: getTypeUse
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public TypeUse getTypeUse(C context, CPropertyInfo propertyInfo) {
if (propertyInfo instanceof CValuePropertyInfo) {
return ((CValuePropertyInfo) propertyInfo).getTarget();
} else if (propertyInfo instanceof CAttributePropertyInfo) {
return ((CAttributePropertyInfo) propertyInfo).getTarget();
} else {
final CTypeInfo type = propertyInfo.ref().iterator().next();
if (type instanceof CBuiltinLeafInfo) {
if (propertyInfo.getAdapter() != null) {
return TypeUseFactory.adapt((CBuiltinLeafInfo) type,
propertyInfo.getAdapter());
} else {
return (CBuiltinLeafInfo) type;
}
} else if (type instanceof CElementInfo) {
final CElementInfo elementInfo = (CElementInfo) type;
return getTypeUse(context, elementInfo.getProperty());
} else {
throw new AssertionError("Unexpected type.");
}
}
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:24,代码来源:DefaultGetTypes.java
示例7: run
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
@Override
public boolean run(Outline outline, Options options,
ErrorHandler errorHandler) {
for (final CElementInfo elementInfo : outline.getModel()
.getAllElements()) {
final ElementOutline elementOutline = outline
.getElement(elementInfo);
if (elementOutline != null) {
processElementOutline(elementOutline, options, errorHandler);
}
}
for (final ClassOutline classOutline : outline.getClasses()) {
processClassOutline(classOutline, options, errorHandler);
}
for (final EnumOutline enumOutline : outline.getEnums()) {
processEnumOutline(enumOutline, options, errorHandler);
}
return true;
}
开发者ID:highsource,项目名称:jaxb2-annotate-plugin,代码行数:22,代码来源:AnnotatePlugin.java
示例8: findCustomizations
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public static List<CPluginCustomization> findCustomizations(CElementInfo elementInfo, QName name) {
final CCustomizations customizations = CustomizationUtils.getCustomizations(elementInfo);
final List<CPluginCustomization> pluginCustomizations = new LinkedList<CPluginCustomization>();
for (CPluginCustomization pluginCustomization : customizations) {
if (fixNull(pluginCustomization.element.getNamespaceURI()).equals(name.getNamespaceURI())
&& fixNull(pluginCustomization.element.getLocalName()).equals(name.getLocalPart())) {
pluginCustomization.markAsAcknowledged();
pluginCustomizations.add(pluginCustomization);
}
}
return pluginCustomizations;
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:16,代码来源:CustomizationUtils.java
示例9: findCustomization
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public static CPluginCustomization findCustomization(CElementInfo elementInfo, QName name) {
final CCustomizations customizations = CustomizationUtils.getCustomizations(elementInfo);
final CPluginCustomization customization = customizations.find(name.getNamespaceURI(), name.getLocalPart());
if (customization != null) {
customization.markAsAcknowledged();
}
return customization;
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:9,代码来源:CustomizationUtils.java
示例10: getElementInfo
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
protected CElementInfo getElementInfo() {
final CReferencePropertyInfo referencePropertyInfo = (CReferencePropertyInfo) core;
final Collection<CElement> elements = referencePropertyInfo
.getElements();
final CElement element = elements.iterator().next();
final CElementInfo elementInfo = (CElementInfo) element.getType();
return elementInfo;
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:12,代码来源:SingleWrappingReferenceField.java
示例11: unwrapCondifiton
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
@Override
public JExpression unwrapCondifiton(JExpression source) {
final CReferencePropertyInfo core = (CReferencePropertyInfo) this.core;
JExpression predicate = null;
if (core.getElements().isEmpty()) {
predicate = null;
} else {
for (CElement element : core.getElements()) {
if (element instanceof CElementInfo) {
CElementInfo elementinfo = (CElementInfo) element;
final SingleWrappingReferenceElementInfoField field = new SingleWrappingReferenceElementInfoField(
outline, prop, core, elementinfo);
final JExpression condition = field
.unwrapCondifiton(source);
predicate = (predicate == null) ? condition : JOp.cor(
predicate, condition);
} else {
// TODO Other cases currently not supported.
}
}
}
final JExpression isElement = codeModel.ref(JAXBContextUtils.class)
.staticInvoke("isElement").arg(contextPath).arg(source);
return predicate == null ? isElement : JOp.cand(JOp.not(predicate),
isElement);
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:31,代码来源:SingleWrappingReferenceObjectField.java
示例12: getElementInfo
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public CElementInfo getElementInfo(ProcessModel context,
final CReferencePropertyInfo referencePropertyInfo) {
final CElement element = context.getGetTypes()
.getElements(context, referencePropertyInfo).iterator().next();
assert element instanceof CElementInfo;
final CElementInfo elementInfo = (CElementInfo) element;
return elementInfo;
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:10,代码来源:WrapSingleSubstitutedElementReference.java
示例13: getTypeUse
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public CBuiltinLeafInfo getTypeUse(ProcessModel context,
CPropertyInfo propertyInfo) {
final Collection<? extends CTypeInfo> types = context.getGetTypes().process(
context, propertyInfo);
final CElementInfo elementInfo = ((CElementInfo) types
.iterator().next());
final CBuiltinLeafInfo type = (CBuiltinLeafInfo) elementInfo
.getContentType();
return type;
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:15,代码来源:WrapSingleBuiltinReference.java
示例14: getPackageInfo
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
private CClassInfoParent.Package getPackageInfo(CClassInfoParent parent) {
if (parent instanceof CClassInfoParent.Package) {
return (Package) parent;
} else if (parent instanceof CClassInfo) {
return getPackageInfo(((CClassInfo) parent).parent());
} else if (parent instanceof CElementInfo) {
return getPackageInfo(((CElementInfo) parent).parent);
} else {
throw new AssertionError("Unexpexted class info parent [" + parent
+ "].");
}
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:14,代码来源:DefaultIgnoring.java
示例15: buildClass2ElementMapping
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
/**
* Build class name to element name mapping
*
* @param outline, JAXB schema/code model
* @return class name to element name map
*/
private static Map<String, QName> buildClass2ElementMapping(Outline outline) {
Map<String, QName> mapping = new HashMap<String, QName>();
for(CElementInfo ei : outline.getModel().getAllElements()) {
JType exposedType = ei.getContentInMemoryType().toType(outline,Aspect.EXPOSED);
mapping.put(exposedType.fullName(), ei.getElementName());
}
return mapping;
}
开发者ID:bulldog2011,项目名称:mxjc,代码行数:15,代码来源:ClassModelBuilder.java
示例16: updateObjectFactoryElements
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
/**
* Marks ObjectFactory.createXYZ methods for elements with a:rawType annotation as @Raw.
*/
private void updateObjectFactoryElements(Outline outline) {
XSSchemaSet schemaSet = outline.getModel().schemaComponent;
for (CElementInfo elementInfo : outline.getModel().getAllElements()) {
QName name = elementInfo.getElementName();
XSComponent elementDecl;
if (elementInfo.getSchemaComponent() != null) { // it's strange but elements seem not to have this filled-in...
elementDecl = elementInfo.getSchemaComponent();
} else {
elementDecl = schemaSet.getElementDecl(name.getNamespaceURI(), name.getLocalPart());
}
boolean isRaw = hasAnnotation(elementDecl, A_RAW_TYPE);
if (isRaw) {
print("*** Raw element found: " + elementInfo.getElementName());
JDefinedClass objectFactory = outline.getPackageContext(elementInfo._package()).objectFactory();
boolean methodFound = false; // finding method corresponding to the given element
for (JMethod method : objectFactory.methods()) {
for (JAnnotationUse annotationUse : method.annotations()) {
if (XmlElementDecl.class.getName().equals(annotationUse.getAnnotationClass().fullName())) {
// ugly method of finding the string value of the annotation members (couldn't find any better)
JAnnotationValue namespaceValue = annotationUse.getAnnotationMembers().get("namespace");
StringWriter namespaceWriter = new StringWriter();
JFormatter namespaceFormatter = new JFormatter(namespaceWriter);
namespaceValue.generate(namespaceFormatter);
JAnnotationValue nameValue = annotationUse.getAnnotationMembers().get("name");
StringWriter nameWriter = new StringWriter();
JFormatter nameFormatter = new JFormatter(nameWriter);
nameValue.generate(nameFormatter);
if (("\""+name.getNamespaceURI()+"\"").equals(namespaceWriter.toString()) &&
("\""+name.getLocalPart()+"\"").equals(nameWriter.toString())) {
print("*** Annotating method as @Raw: " + method.name());
method.annotate(Raw.class);
methodFound = true;
break;
}
}
}
}
if (!methodFound) {
throw new IllegalStateException("No factory method found for element " + name);
}
}
}
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:49,代码来源:SchemaProcessor.java
示例17: CMElementOutlineGenerator
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public CMElementOutlineGenerator(Outline outline, CElementInfo elementInfo) {
Validate.notNull(outline);
Validate.notNull(elementInfo);
this.outline = outline;
this.elementInfo = elementInfo;
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:7,代码来源:CMElementOutlineGenerator.java
示例18: getLocalName
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
@Override
protected String getLocalName(CElementInfo info) {
return info.shortName();
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:5,代码来源:XJCCMInfoFactory.java
示例19: createElementInfoOrigin
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
@Override
protected MElementInfoOrigin createElementInfoOrigin(CElementInfo info) {
return new XJCCMElementInfoOrigin(info);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:5,代码来源:XJCCMInfoFactory.java
示例20: XJCCMElementInfoOrigin
import com.sun.tools.xjc.model.CElementInfo; //导入依赖的package包/类
public XJCCMElementInfoOrigin(CElementInfo source) {
super(source);
component = source.getSchemaComponent() != null ? source
.getSchemaComponent() : source.getProperty()
.getSchemaComponent();
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:7,代码来源:XJCCMElementInfoOrigin.java
注:本文中的com.sun.tools.xjc.model.CElementInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论