public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
/** * Adds a new property. */ public void addProperty(CPropertyInfo prop) { if(prop.ref().isEmpty()) // this property isn't contributing anything // this happens when you try to map an empty sequence to a property return; prop.setParent(this); properties.add(prop); }
/** * Adds a new property. */ public void addProperty(CPropertyInfo prop) { if(prop.ref().isEmpty()) // this property isn't contributing anything // this happens when you try to map an empty sequence to a property return; prop.setParent(this); properties.add(prop); }
public SingleEnumValueWrappingField(ClassOutlineImpl context, CPropertyInfo prop, CPropertyInfo core) { super(context, prop, core); // Single assert !core.isCollection(); // Builtin assert core.ref().size() == 1; assert core.ref().iterator().next() instanceof CEnumLeafInfo; this.enumType = (CEnumLeafInfo) core.ref().iterator().next(); this.enumClass = this.enumType.toType(context.parent(), Aspect.EXPOSED); }
/** * Adds a new property. */ public void addProperty(CPropertyInfo prop) { if(prop.ref().isEmpty()) // this property isn't contributing anything // this happens when you try to map an empty sequence to a property return; prop.setParent(this); properties.add(prop); }
/** * Adds a new property. */ public void addProperty(CPropertyInfo prop) { if(prop.ref().isEmpty()) // this property isn't contributing anything // this happens when you try to map an empty sequence to a property return; prop.setParent(this); properties.add(prop); }
/** * Adds a new property. */ public void addProperty(CPropertyInfo prop) { if(prop.ref().isEmpty()) // this property isn't contributing anything // this happens when you try to map an empty sequence to a property return; prop.setParent(this); properties.add(prop); }
protected boolean isHomoField(PrincipalStrategy principalStrategy, FieldOutline fieldOutline, Options options) { return fieldOutline.getPropertyInfo().ref().size() == 1; }
private boolean isFieldReference(JFieldVar field, ClassOutline classOutline) { CPropertyInfo propertyInfo = classOutline.target.getProperty(field.name()); Collection<? extends CTypeInfo> collection = propertyInfo.ref(); if (collection == null || collection.isEmpty()) { return false; } CTypeInfo info = collection.iterator().next(); if (info instanceof CClassInfo) { CClassInfo classInfo = (CClassInfo) info; if (OBJECT_REFERENCE_TYPE.equals(classInfo.getTypeName())) { return true; } } return false; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. * <p> * <b>Description and code copied from the class SingleField</b> * * @see <a href="https://jaxb2-commons.dev.java.net/source/browse/jaxb2-commons/property-listener-injector/src/com/sun/tools/xjc/addon/property_listener_injector/SingleField.java"> * https://jaxb2-commons.dev.java.net/source/browse/jaxb2-commons/property-listener-injector/src/com/sun/tools/xjc/addon/property_listener_injector/SingleField.java</a> */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
public Collection<? extends CTypeInfo> ref(C context, CPropertyInfo propertyInfo) { final Collection<? extends CTypeInfo> types = propertyInfo.ref(); final JType baseType = propertyInfo.baseType; final ID id = propertyInfo.id(); final CTypeInfo parent = propertyInfo.parent(); if (ID.IDREF.equals(id) && baseType != null) { if (parent instanceof CClassInfo) { final CClassInfo parentClassInfo = (CClassInfo) parent; final String fullName = baseType.fullName(); for (CClassInfo possibleClassInfo : parentClassInfo.model .beans().values()) { final String possibleFullName = possibleClassInfo .fullName(); if (fullName != null && fullName.equals(possibleFullName)) { return Collections.singleton(possibleClassInfo); } } } } return types; }
public static Set<JType> getPossibleTypes(FieldOutline fieldOutline, Aspect aspect) { Validate.notNull(fieldOutline); final ClassOutline classOutline = fieldOutline.parent(); final Outline outline = classOutline.parent(); final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Set<JType> types = new HashSet<JType>(); if (propertyInfo.getAdapter() != null) { types.add(propertyInfo.getAdapter().customType.toType(fieldOutline .parent().parent(), aspect)); } else if (propertyInfo.baseType != null) { types.add(propertyInfo.baseType); } else { Collection<? extends CTypeInfo> typeInfos = propertyInfo.ref(); for (CTypeInfo typeInfo : typeInfos) { types.addAll(getPossibleTypes(outline, aspect, typeInfo)); } } return types; }
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."); } } } }