@Override public ObjectContainer<T> convertObjectContainer(String typeStr) { /* * TODO Really needs to do a Primitive search... :/ */ if (typeStr.startsWith("TYPE=") || typeStr.startsWith("TYPE.")) { return factory.getTypeReference(typeStr.substring(5).split("\\.")); } throw new IllegalArgumentException("ObjectContainer does not support: " + typeStr); }
/** * Gets a reference to the Class or Class/Context provided by this AbstractReferenceManufacturer. * The reference will be a reference to the objects identified by the given types. * * @param types An array of the types of objects to which the returned CDOMReference will refer. * @return A CDOMGroupRef which is intended to contain objects of a given Type for the Class or * Class/Context this AbstractReferenceManufacturer represents. * @throws IllegalArgumentException if any of the given Strings is null, empty (length is zero), * or contains a period (.), equals (=), comma (,) or pipe (|) */ @Override public CDOMGroupRef<T> getTypeReference(String... types) { for (String type : types) { if (type == null || type.length() == 0) { throw new IllegalArgumentException( "Attempt to acquire empty Type " + "(the type String contains a null or empty element)"); } if (type.indexOf('.') != -1) { throw new IllegalArgumentException( "Cannot build Reference with type conaining a period: " + type); } if (type.indexOf('=') != -1) { throw new IllegalArgumentException( "Cannot build Reference with type conaining an equals: " + type); } if (type.indexOf(',') != -1) { throw new IllegalArgumentException( "Cannot build Reference with type conaining a comma: " + type); } if (type.indexOf('|') != -1) { throw new IllegalArgumentException( "Cannot build Reference with type conaining a pipe: " + type); } } Arrays.sort(types); FixedStringList typeList = new FixedStringList(types); WeakReference<CDOMGroupRef<T>> ref = typeReferences.get(typeList); if (ref != null) { CDOMGroupRef<T> trt = ref.get(); if (trt != null) { return trt; } } // Didn't find the appropriate key, create new CDOMGroupRef<T> cgr = factory.getTypeReference(types); typeReferences.put(typeList, new WeakReference<CDOMGroupRef<T>>(cgr)); return cgr; }