public XSComponent getSchemaComponent(ProcessModel context, CPropertyInfo propertyInfo) { return propertyInfo.getSchemaComponent(); }
public XSComponent getSchemaComponent(ProcessModel context, CPropertyInfo propertyInfo) { return propertyInfo.getSchemaComponent(); }
public XSComponent getSchemaComponent() { return getSource().getSchemaComponent(); }
public Integer createColumn$Scale(CPropertyInfo property) { final Integer scale; final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(property.getSchemaComponent()); final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(property .getSchemaComponent()); if (fractionDigits != null) { scale = fractionDigits.intValue(); } else if (totalDigits != null) { scale = totalDigits.intValue(); } else { scale = null; } return scale; }
public Integer createColumn$Scale(CPropertyInfo property) { final Integer scale; final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(property.getSchemaComponent()); final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(property .getSchemaComponent()); if (fractionDigits != null) { scale = fractionDigits.intValue(); } else if (totalDigits != null) { scale = totalDigits.intValue(); } else { scale = null; } return scale; }
/** * Returns XSD declaration of given property. */ public static XSDeclaration getXsdDeclaration(CPropertyInfo propertyInfo) { XSComponent schemaComponent = propertyInfo.getSchemaComponent(); if (!(schemaComponent instanceof XSParticle)) { // XSComplexType for example: return null; } XSTerm term = ((XSParticle) schemaComponent).getTerm(); if (!(term instanceof XSDeclaration)) { // XSModelGroup for example: return null; } return (XSDeclaration) term; } }
public Integer createColumn$Precision(CPropertyInfo property) { final Integer precision; final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(property .getSchemaComponent()); final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(property.getSchemaComponent()); if (totalDigits != null) { if (fractionDigits != null) { precision = totalDigits.intValue() + fractionDigits.intValue(); } else { precision = totalDigits.intValue() * 2; } } else { precision = null; } return precision; }
/** * Returns XSD declaration of given property. */ public static XSDeclaration getXsdDeclaration(CPropertyInfo propertyInfo) { XSComponent schemaComponent = propertyInfo.getSchemaComponent(); if (!(schemaComponent instanceof XSParticle)) { // XSComplexType for example: return null; } XSTerm term = ((XSParticle) schemaComponent).getTerm(); if (!(term instanceof XSDeclaration)) { // XSModelGroup for example: return null; } return (XSDeclaration) term; } }
public Integer createColumn$Precision(CPropertyInfo property) { final Integer precision; final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(property .getSchemaComponent()); final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(property.getSchemaComponent()); if (totalDigits != null) { if (fractionDigits != null) { precision = totalDigits.intValue() + fractionDigits.intValue(); } else { precision = totalDigits.intValue() * 2; } } else { precision = null; } return precision; }
public Integer createColumn$Precision(FieldOutline fieldOutline) { final Integer precision; final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(fieldOutline .getPropertyInfo().getSchemaComponent()); final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(fieldOutline.getPropertyInfo() .getSchemaComponent()); if (totalDigits != null) { if (fractionDigits != null) { precision = totalDigits.intValue() + fractionDigits.intValue(); } else { precision = totalDigits.intValue() * 2; } } else { precision = null; } return precision; }
public Integer createColumn$Scale(FieldOutline fieldOutline) { final Integer scale; final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(fieldOutline.getPropertyInfo() .getSchemaComponent()); final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(fieldOutline .getPropertyInfo().getSchemaComponent()); if (fractionDigits != null) { scale = fractionDigits.intValue(); } else if (totalDigits != null) { scale = totalDigits.intValue(); } else { scale = null; } return scale; }
public Integer createColumn$Precision(FieldOutline fieldOutline) { final Integer precision; final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(fieldOutline .getPropertyInfo().getSchemaComponent()); final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(fieldOutline.getPropertyInfo() .getSchemaComponent()); if (totalDigits != null) { if (fractionDigits != null) { precision = totalDigits.intValue() + fractionDigits.intValue(); } else { precision = totalDigits.intValue() * 2; } } else { precision = null; } return precision; }
public Integer createColumn$Scale(FieldOutline fieldOutline) { final Integer scale; final Long fractionDigits = SimpleTypeAnalyzer .getFractionDigits(fieldOutline.getPropertyInfo() .getSchemaComponent()); final Long totalDigits = SimpleTypeAnalyzer.getTotalDigits(fieldOutline .getPropertyInfo().getSchemaComponent()); if (fractionDigits != null) { scale = fractionDigits.intValue(); } else if (totalDigits != null) { scale = totalDigits.intValue(); } else { scale = null; } return scale; }
public static BIDeclaration hasAnnotation(ClassOutline classOutline, JFieldVar field, QName qname) { CPropertyInfo propertyInfo = classOutline.target.getProperty(field.name()); if (propertyInfo == null || !(propertyInfo.getSchemaComponent() instanceof XSParticle)) { return null; } XSParticle particle = (XSParticle)propertyInfo.getSchemaComponent(); if (particle.getTerm() == null) { return null; } XSAnnotation annotation = particle.getTerm().getAnnotation(false); return hasAnnotation(annotation, qname); }
public TypeUse process(ProcessModel context, CPropertyInfo propertyInfo) { // propertyInfo.g final TypeUse type = context.getGetTypes().getTypeUse(context, propertyInfo); final XSComponent schemaComponent = propertyInfo.getSchemaComponent(); if (schemaComponent != null) { final List<QName> typeNames = TypeUtils .getTypeNames(schemaComponent); for (QName typeName : typeNames) { final PropertyType propertyType = new PropertyType(type, typeName); if (adapters.containsKey(propertyType)) { final TypeUse createPropertyInfos = adapters .get(propertyType); return createPropertyInfos; } } return adapters.get(new PropertyType(type)); } else { return adapters.get(new PropertyType(type)); } }
public TypeUse process(ProcessModel context, CPropertyInfo propertyInfo) { // propertyInfo.g final TypeUse type = context.getGetTypes().getTypeUse(context, propertyInfo); final XSComponent schemaComponent = propertyInfo.getSchemaComponent(); if (schemaComponent != null) { final List<QName> typeNames = TypeUtils .getTypeNames(schemaComponent); for (QName typeName : typeNames) { final PropertyType propertyType = new PropertyType(type, typeName); if (adapters.containsKey(propertyType)) { final TypeUse createPropertyInfos = adapters .get(propertyType); return createPropertyInfos; } } return adapters.get(new PropertyType(type)); } else { return adapters.get(new PropertyType(type)); } }
/** * Check that given field property has name customization ({@code <jaxb:property name="..." />}). * * @see <code>com.sun.xml.bind.api.impl.NameUtil</code> * @see com.sun.codemodel.JJavaName * @see com.sun.tools.xjc.reader.xmlschema.bindinfo.BIProperty#getCustomization(XSComponent) */ public static boolean hasPropertyNameCustomization(CPropertyInfo fieldPropertyInfo) { XSAnnotation annotation = fieldPropertyInfo.getSchemaComponent().getAnnotation(); if (annotation == null) { annotation = getXsdDeclaration(fieldPropertyInfo).getAnnotation(); } if (annotation == null || !(annotation.getAnnotation() instanceof BindInfo)) { return false; } for (BIDeclaration declaration : (BindInfo) annotation.getAnnotation()) { if (declaration instanceof BIProperty) { return true; } } return false; }
/** * Check that given field property has name customization ({@code <jaxb:property name="..." />}). * * @see <code>com.sun.xml.bind.api.impl.NameUtil</code> * @see com.sun.codemodel.JJavaName * @see com.sun.tools.xjc.reader.xmlschema.bindinfo.BIProperty#getCustomization(XSComponent) */ public static boolean hasPropertyNameCustomization(CPropertyInfo fieldPropertyInfo) { XSAnnotation annotation = fieldPropertyInfo.getSchemaComponent().getAnnotation(); if (annotation == null) { annotation = getXsdDeclaration(fieldPropertyInfo).getAnnotation(); } if (annotation == null || !(annotation.getAnnotation() instanceof BindInfo)) { return false; } for (BIDeclaration declaration : (BindInfo) annotation.getAnnotation()) { if (declaration instanceof BIProperty) { return true; } } return false; }
private AvroType avroFromProperty(CPropertyInfo info, NType type, JPackage _package, boolean unionNull) { AvroType returnType = avroFromType(type, _package); String defaultValue = extractDefaultValue(info.getSchemaComponent()); if (!isPropertyRequired(info) && unionNull) { if (returnType instanceof AvroUnion) { throw new SchemagenException("nested unions are not allowed"); } returnType = new AvroUnion(AvroPrimitive.PrimitiveType.NULL.newInstance(), returnType); if (defaultValue == null) { defaultValue = AvroPrimitive.PrimitiveType.NULL.defaultValue; } } if (defaultValue != null) { returnType.setDefaultValue(defaultValue); } return returnType; }
private String getConstantName(final FieldOutline fieldOutline) { final XSComponent schemaComponent = fieldOutline.getPropertyInfo().getSchemaComponent(); if (!this.fixedAttributeAsConstantProperty) return null; if (schemaComponent instanceof XSAttributeDecl) { return ((XSAttributeDecl)schemaComponent).getFixedValue() != null ? fieldOutline.parent().parent().getModel().getNameConverter().toConstantName(((XSAttributeDecl)schemaComponent).getName()) : null; } else { return schemaComponent instanceof XSAttributeUse && ((XSAttributeUse)schemaComponent).getFixedValue() != null ? fieldOutline.parent().parent().getModel().getNameConverter().toConstantName(((XSAttributeUse)schemaComponent).getDecl().getName()) : null; } }