protected EnumLeafInfoImpl<T,C,F,M> createEnumLeafInfo(C clazz,Locatable upstream) { return new EnumLeafInfoImpl<T,C,F,M>(this,upstream,clazz,nav.use(clazz)); }
public Iterable<? extends EnumConstantImpl<T,C,F,M>> getConstants() { if(firstConstant==null) calcConstants(); return this; }
Collection<? extends F> fields = nav().getDeclaredFields(clazz); for (F f : fields) { if (nav().isSameType(nav().getFieldType(f), nav().ref(String.class))) { XmlSchemaType schemaTypeAnnotation = builder.reader.getFieldAnnotation(XmlSchemaType.class, f, this); if (schemaTypeAnnotation != null) { F[] constants = nav().getEnumConstants(clazz); for( int i=constants.length-1; i>=0; i-- ) { F constant = constants[i]; String name = nav().getFieldName(constant); XmlEnumValue xev = builder.reader.getFieldAnnotation(XmlEnumValue.class, constant, this); else literal = xev.value(); last = createEnumConstant(name,literal,constant,last);
/** * @param clazz * @param type * clazz and type should both point to the enum class * that this {@link EnumLeafInfo} represents. * Because of the type parameterization we have to take them separately. */ public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder, Locatable upstream, C clazz, T type ) { super(builder,upstream); this.clazz = clazz; this.type = type; elementName = parseElementName(clazz); // compute the type name // TODO: I guess it must be allowed for enums to have @XmlElement typeName = parseTypeName(clazz); // locate the base type. // this can be done eagerly because there shouldn't be no cycle. XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this); if(xe!=null) { T base = builder.reader.getClassValue(xe, "value"); baseType = builder.getTypeInfo(base,this); } else { baseType = builder.getTypeInfo(builder.nav.ref(String.class),this); } }
@Override public void link() { // make sure we've computed constants getConstants(); super.link(); }
public Element<T,C> asElement() { if(isElement()) return this; else return null; }
public Location getLocation() { return nav().getClassLocation(clazz); }
/** * Called after all the classes are added to the type set * to "link" them together. * * <p> * Don't expose implementation classes in the signature. * * @return * fully built {@link TypeInfoSet} that represents the model, * or null if there was an error. */ public TypeInfoSet<T,C,F,M> link() { assert !linked; linked = true; for( ElementInfoImpl ei : typeInfoSet.getAllElements() ) ei.link(); for( ClassInfoImpl ci : typeInfoSet.beans().values() ) ci.link(); for( EnumLeafInfoImpl li : typeInfoSet.enums().values() ) li.link(); if(hadError) return null; else return typeInfoSet; }
/** * @param clazz * @param type * clazz and type should both point to the enum class * that this {@link EnumLeafInfo} represents. * Because of the type parameterization we have to take them separately. */ public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder, Locatable upstream, C clazz, T type ) { super(builder,upstream); this.clazz = clazz; this.type = type; elementName = parseElementName(clazz); // compute the type name // TODO: I guess it must be allowed for enums to have @XmlElement typeName = parseTypeName(clazz); // locate the base type. // this can be done eagerly because there shouldn't be no cycle. XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this); if(xe!=null) { T base = builder.reader.getClassValue(xe, "value"); baseType = builder.getTypeInfo(base,this); } else { baseType = builder.getTypeInfo(builder.nav.ref(String.class),this); } }
@Override public void link() { // make sure we've computed constants getConstants(); super.link(); }
public Element<T,C> asElement() { if(isElement()) return this; else return null; }
public Location getLocation() { return nav().getClassLocation(clazz); }
/** * Called after all the classes are added to the type set * to "link" them together. * * <p> * Don't expose implementation classes in the signature. * * @return * fully built {@link TypeInfoSet} that represents the model, * or null if there was an error. */ public TypeInfoSet<T,C,F,M> link() { assert !linked; linked = true; for( ElementInfoImpl ei : typeInfoSet.getAllElements() ) ei.link(); for( ClassInfoImpl ci : typeInfoSet.beans().values() ) ci.link(); for( EnumLeafInfoImpl li : typeInfoSet.enums().values() ) li.link(); if(hadError) return null; else return typeInfoSet; }
/** * @param clazz * @param type * clazz and type should both point to the enum class * that this {@link EnumLeafInfo} represents. * Because of the type parameterization we have to take them separately. */ public EnumLeafInfoImpl(ModelBuilder<T,C,F,M> builder, Locatable upstream, C clazz, T type ) { super(builder,upstream); this.clazz = clazz; this.type = type; elementName = parseElementName(clazz); // compute the type name // TODO: I guess it must be allowed for enums to have @XmlElement typeName = parseTypeName(clazz); // locate the base type. // this can be done eagerly because there shouldn't be no cycle. XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this); if(xe!=null) { T base = builder.reader.getClassValue(xe, "value"); baseType = builder.getTypeInfo(base,this); } else { baseType = builder.getTypeInfo(builder.nav.ref(String.class),this); } }
Collection<? extends F> fields = nav().getDeclaredFields(clazz); for (F f : fields) { if (nav().isSameType(nav().getFieldType(f), nav().ref(String.class))) { XmlSchemaType schemaTypeAnnotation = builder.reader.getFieldAnnotation(XmlSchemaType.class, f, this); if (schemaTypeAnnotation != null) { F[] constants = nav().getEnumConstants(clazz); for( int i=constants.length-1; i>=0; i-- ) { F constant = constants[i]; String name = nav().getFieldName(constant); XmlEnumValue xev = builder.reader.getFieldAnnotation(XmlEnumValue.class, constant, this); else literal = xev.value(); last = createEnumConstant(name,literal,constant,last);
public Iterable<? extends EnumConstantImpl<T,C,F,M>> getConstants() { if(firstConstant==null) calcConstants(); return this; }
@Override public void link() { // make sure we've computed constants getConstants(); super.link(); }
public Element<T,C> asElement() { if(isElement()) return this; else return null; }
protected EnumLeafInfoImpl<T,C,F,M> createEnumLeafInfo(C clazz,Locatable upstream) { return new EnumLeafInfoImpl<T,C,F,M>(this,upstream,clazz,nav.use(clazz)); }
public Location getLocation() { return nav().getClassLocation(clazz); }