/** Helper method to find the Types actual value from its name */ public static String returnTypeIdFromTypeName(FeatureType[] types, String name) { for (FeatureType type : types) { if (type.getName().equals(name)) { return type.getId(); } } return null; }
/** Helper method to create a HashMap of types using the Id (value) as the key */ public static HashMap<String, FeatureType> createTypeMapByValue(FeatureType[] types) { HashMap<String, FeatureType> typeMap = new HashMap<String, FeatureType>(); for (FeatureType type : types) { typeMap.put(type.getId(), type); } return typeMap; }
/** Helper method to create a String array of Type values for populating a spinner */ public static String[] createTypeNameArray(FeatureType[] types) { String[] typeNames = new String[types.length]; int i = 0; for (FeatureType type : types) { typeNames[i] = type.getName(); i++; } return typeNames; }