/** * Get a type instance. * * @param typeName name of a type found in a feed. Current version of * the API will always return one of the types listed in this class * but future versions might support new types, so <code>getInstance</code> * accepts any type name * @return an instance of GoogleBaseAttributeType, or <code>null</code> * if <code>typeName</code> was null */ public static GoogleBaseAttributeType getInstance(String typeName) { if (typeName == null) { return null; } GoogleBaseAttributeType commonType = KNOWN_TYPES.get(typeName); if (commonType != null) { return commonType; } else { return new GoogleBaseAttributeType(null, typeName); } }
/** * Get a type instance. * * @param typeName name of a type found in a feed. Current version of * the API will always return one of the types listed in this class * but future versions might support new types, so <code>getInstance</code> * accepts any type name * @return an instance of GoogleBaseAttributeType, or <code>null</code> * if <code>typeName</code> was null */ public static GoogleBaseAttributeType getInstance(String typeName) { if (typeName == null) { return null; } GoogleBaseAttributeType commonType = KNOWN_TYPES.get(typeName); if (commonType != null) { return commonType; } else { return new GoogleBaseAttributeType(null, typeName); } }
/** * Creates a new type with a supertype and registers it so that * {@link #getInstance(String)} will find it. * * @param supertype * @param name * @return the new type */ private static GoogleBaseAttributeType createAndRegister( GoogleBaseAttributeType supertype, String name) { GoogleBaseAttributeType type = new GoogleBaseAttributeType(supertype, name); KNOWN_TYPES.put(type.getName(), type); return type; }
/** * Creates a new type with a supertype and registers it so that * {@link #getInstance(String)} will find it. * * @param supertype * @param name * @return the new type */ private static GoogleBaseAttributeType createAndRegister( GoogleBaseAttributeType supertype, String name) { GoogleBaseAttributeType type = new GoogleBaseAttributeType(supertype, name); KNOWN_TYPES.put(type.getName(), type); return type; }