com.sun.tools.xjc.model.CValuePropertyInfo Java Examples
The following examples show how to use
com.sun.tools.xjc.model.CValuePropertyInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractField.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
/** * Annotate the field according to the recipes given as {@link CPropertyInfo}. */ protected void annotate( JAnnotatable field ) { assert(field!=null); if (prop instanceof CAttributePropertyInfo) { annotateAttribute(field); } else if (prop instanceof CElementPropertyInfo) { annotateElement(field); } else if (prop instanceof CValuePropertyInfo) { field.annotate(XmlValue.class); } else if (prop instanceof CReferencePropertyInfo) { annotateReference(field); } outline.parent().generateAdapterIfNecessary(prop,field); }
Example #2
Source File: JaxbValidationsPlugins.java From krasa-jaxb-tools with Apache License 2.0 | 6 votes |
private void processAttribute(CValuePropertyInfo property, ClassOutline clase, Outline model) { FieldOutline field = model.getField(property); String propertyName = property.getName(false); String className = clase.implClass.name(); log("Attribute " + propertyName + " added to class " + className); XSComponent definition = property.getSchemaComponent(); RestrictionSimpleTypeImpl particle = (RestrictionSimpleTypeImpl) definition; XSSimpleType type = particle.asSimpleType(); JFieldVar var = clase.implClass.fields().get(propertyName); // if (particle.isRequired()) { // if (!hasAnnotation(var, NotNull.class)) { // if (notNullAnnotations) { // System.out.println("@NotNull: " + propertyName + " added to class " + className); // var.annotate(NotNull.class); // } // } // } validAnnotation(type, var, propertyName, className); processType(type, var, propertyName, className); }
Example #3
Source File: JaxbValidationsPlugins.java From krasa-jaxb-tools with Apache License 2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { try { for (ClassOutline co : model.getClasses()) { List<CPropertyInfo> properties = co.target.getProperties(); for (CPropertyInfo property : properties) { if (property instanceof CElementPropertyInfo) { processElement((CElementPropertyInfo) property, co, model); } else if (property instanceof CAttributePropertyInfo) { processAttribute((CAttributePropertyInfo) property, co, model); } else if (property instanceof CValuePropertyInfo) { processAttribute((CValuePropertyInfo) property, co, model); } } } return true; } catch (Exception e) { log(e); return false; } }
Example #4
Source File: DefaultGetTypes.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
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."); } } }
Example #5
Source File: TypeUseUtils.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
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."); } } }
Example #6
Source File: SimplifyPlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
private void postProcessClassInfo(final Model model, final CClassInfo classInfo) { final List<CPropertyInfo> properties = new ArrayList<CPropertyInfo>( classInfo.getProperties()); for (CPropertyInfo property : properties) { property.accept(new CPropertyVisitor<Void>() { public Void onElement(CElementPropertyInfo elementProperty) { postProcessElementPropertyInfo(model, classInfo, elementProperty); return null; } public Void onAttribute(CAttributePropertyInfo attributeProperty) { // TODO Auto-generated method stub return null; } public Void onValue(CValuePropertyInfo valueProperty) { // TODO Auto-generated method stub return null; } public Void onReference(CReferencePropertyInfo p) { postProcessReferencePropertyInfo(model, classInfo, p); return null; } }); } }
Example #7
Source File: CClassifyingVisitor.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 5 votes |
public U onValue(CValuePropertyInfo valuePropertyInfo) { final CNonElement type = context.getGetTypes().getTarget(context, valuePropertyInfo); if (type instanceof CBuiltinLeafInfo) { return onBuiltinValue(valuePropertyInfo); } else if (type instanceof CEnumLeafInfo) { return onEnumValue(valuePropertyInfo); } else { return onOtherValue(valuePropertyInfo); } }
Example #8
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onCollectionOtherValue( CValuePropertyInfo valuePropertyInfo) { logger.error("[" + valuePropertyInfo.getName(true) + "] is a collection other value. See issue #63."); return Collections.emptyList(); }
Example #9
Source File: CClassifyingVisitor.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public U onBuiltinValue(CValuePropertyInfo valuePropertyInfo) { return !valuePropertyInfo.isCollection() ? classifier .onSingleBuiltinValue(valuePropertyInfo) : classifier .onCollectionBuiltinValue(valuePropertyInfo); }
Example #10
Source File: CClassifyingVisitor.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public U onEnumValue(CValuePropertyInfo valuePropertyInfo) { return !valuePropertyInfo.isCollection() ? classifier .onSingleEnumValue(valuePropertyInfo) : classifier .onCollectionEnumValue(valuePropertyInfo); }
Example #11
Source File: CClassifyingVisitor.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public U onOtherValue(CValuePropertyInfo valuePropertyInfo) { return !valuePropertyInfo.isCollection() ? classifier .onSingleOtherValue(valuePropertyInfo) : classifier .onCollectionOtherValue(valuePropertyInfo); }
Example #12
Source File: DefaultGetTypes.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public CNonElement getTarget(C context, CValuePropertyInfo propertyInfo) { return propertyInfo.getTarget(); }
Example #13
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onCollectionEnumValue( CValuePropertyInfo valuePropertyInfo) { return context.getWrapCollectionEnumValue().process(context, valuePropertyInfo); }
Example #14
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onSingleBuiltinValue( CValuePropertyInfo valuePropertyInfo) { return context.getWrapSingleBuiltinValue().process(context, valuePropertyInfo); }
Example #15
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onSingleEnumValue( CValuePropertyInfo valuePropertyInfo) { return context.getWrapSingleEnumValue().process(context, valuePropertyInfo); }
Example #16
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onSingleOtherValue( CValuePropertyInfo valuePropertyInfo) { logger.error("[" + valuePropertyInfo.getName(true) + "] is a single other value. See issue #60."); return Collections.emptyList(); }
Example #17
Source File: DefaultProcessPropertyInfos.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public Collection<CPropertyInfo> onCollectionBuiltinValue( CValuePropertyInfo valuePropertyInfo) { return context.getWrapCollectionBuiltinValue().process(context, valuePropertyInfo); }
Example #18
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onSingleBuiltinValue(CValuePropertyInfo valuePropertyInfo);
Example #19
Source File: GetTypes.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public CNonElement getTarget(C context, CValuePropertyInfo propertyInfo);
Example #20
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onSingleEnumValue(CValuePropertyInfo valuePropertyInfo);
Example #21
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onCollectionOtherValue(CValuePropertyInfo valuePropertyInfo);
Example #22
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onCollectionEnumValue(CValuePropertyInfo valuePropertyInfo);
Example #23
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onCollectionBuiltinValue(CValuePropertyInfo valuePropertyInfo);
Example #24
Source File: CClassifier.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | votes |
public V onSingleOtherValue(CValuePropertyInfo valuePropertyInfo);