private MediaTypeRange(String token) { Builder b = new Builder(token); this.mediaType = b.mediaType; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
private StringRange(String token) { Builder b = new Builder(token); this.type = b.type; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
private StringRange(String token) { Builder b = new Builder(token); this.type = b.type; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
private StringRange(String token) { Builder b = new Builder(token); this.type = b.type; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
private MediaTypeRange(String token) { Builder b = new Builder(token); this.mediaType = b.mediaType; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
private MediaTypeRange(String token) { Builder b = new Builder(token); this.mediaType = b.mediaType; this.qValue = b.qValue; this.extensions = unmodifiableMap(b.extensions); }
MediaType(String mt) { Builder b = new Builder(mt); this.mediaType = b.mediaType; this.type = b.type; this.subType = b.subType; this.subTypes = b.subTypes; this.subTypesSorted = b.subTypesSorted; this.subTypesList = immutableList(subTypes); this.parameters = unmodifiableMap(b.parameters); this.hasSubtypeMeta = b.hasSubtypeMeta; }
MediaType(String mt) { Builder b = new Builder(mt); this.mediaType = b.mediaType; this.type = b.type; this.subType = b.subType; this.subTypes = b.subTypes; this.subTypesSorted = b.subTypesSorted; this.subTypesList = immutableList(subTypes); this.parameters = unmodifiableMap(b.parameters); this.hasSubtypeMeta = b.hasSubtypeMeta; }
MediaType(String mt) { Builder b = new Builder(mt); this.mediaType = b.mediaType; this.type = b.type; this.subType = b.subType; this.subTypes = b.subTypes; this.subTypesSorted = b.subTypesSorted; this.subTypesList = immutableList(subTypes); this.parameters = unmodifiableMap(b.parameters); this.hasSubtypeMeta = b.hasSubtypeMeta; }
public <T> Map<String,T> asMap(Class<T> eType) { if ( eType == String.class && (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) || eType == Integer.class && (type == SORTED_MAP_INTEGER || type == ORDERED_MAP_INTEGER) || eType == Class.class && (type == SORTED_MAP_CLASS || type == ORDERED_MAP_CLASS) || (type == SORTED_MAP_OBJECT || type == ORDERED_MAP_OBJECT)) { return (Map<String,T>)value; } else if (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) { Map<String,T> m = new LinkedHashMap<>(); for (Map.Entry<String,String> e : ((Map<String,String>)value).entrySet()) { T t = ClassUtils.fromString(eType, e.getValue()); if (t == null) throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); m.put(e.getKey(), t); } return unmodifiableMap(m); } else { throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); } }
public <T> Map<String,T> asMap(Class<T> eType) { if ( eType == String.class && (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) || eType == Integer.class && (type == SORTED_MAP_INTEGER || type == ORDERED_MAP_INTEGER) || eType == Class.class && (type == SORTED_MAP_CLASS || type == ORDERED_MAP_CLASS) || (type == SORTED_MAP_OBJECT || type == ORDERED_MAP_OBJECT)) { return (Map<String,T>)value; } else if (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) { Map<String,T> m = new LinkedHashMap<>(); for (Map.Entry<String,String> e : ((Map<String,String>)value).entrySet()) { T t = ClassUtils.fromString(eType, e.getValue()); if (t == null) throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); m.put(e.getKey(), t); } return unmodifiableMap(m); } else { throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); } }
public <T> Map<String,T> asMap(Class<T> eType) { if ( eType == String.class && (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) || eType == Integer.class && (type == SORTED_MAP_INTEGER || type == ORDERED_MAP_INTEGER) || eType == Class.class && (type == SORTED_MAP_CLASS || type == ORDERED_MAP_CLASS) || (type == SORTED_MAP_OBJECT || type == ORDERED_MAP_OBJECT)) { return (Map<String,T>)value; } else if (type == SORTED_MAP_STRING || type == ORDERED_MAP_STRING) { Map<String,T> m = new LinkedHashMap<>(); for (Map.Entry<String,String> e : ((Map<String,String>)value).entrySet()) { T t = ClassUtils.fromString(eType, e.getValue()); if (t == null) throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); m.put(e.getKey(), t); } return unmodifiableMap(m); } else { throw new ConfigException("Invalid property conversion ''{0}'' to ''Map<String,{1}>'' on property ''{2}''", type, eType, name); } }
/** * Constructor. * * @param beanMeta The metadata on the bean that this metadata applies to. */ public XmlBeanMeta(BeanMeta<?> beanMeta) { super(beanMeta); Class<?> c = beanMeta.getClassMeta().getInnerClass(); XmlBeanMetaBuilder b = new XmlBeanMetaBuilder(beanMeta); attrs = unmodifiableMap(b.attrs); elements = unmodifiableMap(b.elements); attrsProperty = b.attrsProperty; collapsedProperties = unmodifiableMap(b.collapsedProperties); contentProperty = b.contentProperty; contentFormat = b.contentFormat; // Do some validation. if (contentProperty != null || contentFormat == XmlFormat.VOID) { if (! elements.isEmpty()) throw new BeanRuntimeException(c, "{0} and ELEMENT properties found on the same bean. These cannot be mixed.", contentFormat); if (! collapsedProperties.isEmpty()) throw new BeanRuntimeException(c, "{0} and COLLAPSED properties found on the same bean. These cannot be mixed.", contentFormat); } if (! collapsedProperties.isEmpty()) { if (! Collections.disjoint(elements.keySet(), collapsedProperties.keySet())) throw new BeanRuntimeException(c, "Child element name conflicts found with another property."); } }
/** * Constructor. * * @param beanMeta The metadata on the bean that this metadata applies to. */ public XmlBeanMeta(BeanMeta<?> beanMeta) { super(beanMeta); Class<?> c = beanMeta.getClassMeta().getInnerClass(); XmlBeanMetaBuilder b = new XmlBeanMetaBuilder(beanMeta); attrs = unmodifiableMap(b.attrs); elements = unmodifiableMap(b.elements); attrsProperty = b.attrsProperty; collapsedProperties = unmodifiableMap(b.collapsedProperties); contentProperty = b.contentProperty; contentFormat = b.contentFormat; // Do some validation. if (contentProperty != null || contentFormat == XmlFormat.VOID) { if (! elements.isEmpty()) throw new BeanRuntimeException(c, "{0} and ELEMENT properties found on the same bean. These cannot be mixed.", contentFormat); if (! collapsedProperties.isEmpty()) throw new BeanRuntimeException(c, "{0} and COLLAPSED properties found on the same bean. These cannot be mixed.", contentFormat); } if (! collapsedProperties.isEmpty()) { if (! Collections.disjoint(elements.keySet(), collapsedProperties.keySet())) throw new BeanRuntimeException(c, "Child element name conflicts found with another property."); } }
/** * Constructor. * * @param c The interface class annotated with a {@link RemoteResource @RemoteResource} annotation (optional). */ public RemoteResourceMeta(Class<?> c) { String path = ""; for (RemoteResource r : getAnnotationsParentFirst(RemoteResource.class, c)) if (! r.path().isEmpty()) path = trimSlashes(r.path()); Map<Method,RemoteMethodMeta> methods = new LinkedHashMap<>(); for (Method m : c.getMethods()) if (isPublic(m)) methods.put(m, new RemoteMethodMeta(path, m, false, "GET")); this.methods = unmodifiableMap(methods); this.path = path; }
/** * Constructor. * * @param vars The Var classes used for resolving string variables. * @param contextObjects Read-only context objects. */ public VarResolverContext(Class<? extends Var>[] vars, Map<String,Object> contextObjects) { this.vars = Arrays.copyOf(vars, vars.length); Map<String,Var> m = new ConcurrentSkipListMap<>(); for (Class<?> c : vars) { if (! isParentClass(Var.class, c)) throw new VarResolverException("Invalid variable class. Must extend from Var"); Var v = newInstance(Var.class, c); m.put(v.getName(), v); } this.varMap = unmodifiableMap(m); this.contextObjects = immutableMap(contextObjects); }
/** * Constructor. * * @param vars The Var classes used for resolving string variables. * @param contextObjects Read-only context objects. */ public VarResolverContext(Class<? extends Var>[] vars, Map<String,Object> contextObjects) { this.vars = Arrays.copyOf(vars, vars.length); Map<String,Var> m = new ConcurrentSkipListMap<>(); for (Class<?> c : vars) { if (! isParentClass(Var.class, c)) throw new VarResolverException("Invalid variable class. Must extend from Var"); Var v = newInstance(Var.class, c); m.put(v.getName(), v); } this.varMap = unmodifiableMap(m); this.contextObjects = immutableMap(contextObjects); }
/** * Constructor. * * @param c The interface class annotated with a {@link RemoteResource @RemoteResource} annotation (optional). */ public RemoteResourceMeta(Class<?> c) { String path = ""; for (RemoteResource r : getAnnotationsParentFirst(RemoteResource.class, c)) if (! r.path().isEmpty()) path = trimSlashes(r.path()); Map<Method,RemoteMethodMeta> methods = new LinkedHashMap<>(); for (Method m : c.getMethods()) if (isPublic(m)) methods.put(m, new RemoteMethodMeta(path, m, false, "GET")); this.methods = unmodifiableMap(methods); this.path = path; }
/** * Constructor. * * @param c The interface class annotated with a {@link RemoteResource @RemoteResource} annotation (optional). */ public RemoteResourceMeta(Class<?> c) { String path = ""; for (RemoteResource r : getAnnotationsParentFirst(RemoteResource.class, c)) if (! r.path().isEmpty()) path = trimSlashes(r.path()); Map<Method,RemoteMethodMeta> methods = new LinkedHashMap<>(); for (Method m : c.getMethods()) if (isPublic(m)) methods.put(m, new RemoteMethodMeta(path, m, false, "GET")); this.methods = unmodifiableMap(methods); this.path = path; }
/** * Constructor. * * @param vars The Var classes used for resolving string variables. * @param contextObjects Read-only context objects. */ public VarResolverContext(Class<? extends Var>[] vars, Map<String,Object> contextObjects) { this.vars = Arrays.copyOf(vars, vars.length); Map<String,Var> m = new ConcurrentSkipListMap<>(); for (Class<?> c : vars) { if (! isParentClass(Var.class, c)) throw new VarResolverException("Invalid variable class. Must extend from Var"); Var v = newInstance(Var.class, c); m.put(v.getName(), v); } this.varMap = unmodifiableMap(m); this.contextObjects = immutableMap(contextObjects); }