@SuppressWarnings("rawtypes") public static Class[] parseStringKeys(String[] keys) { Class[] classes = new Class[keys.length]; for (int i = 0; i < keys.length; i++) { String key = keys[i]; classes[i] = AnnotationLookup.toCoreKey(key); // now work with the key we got above if (classes[i] == null) { throw new UnsupportedOperationException("Unknown key " + key); } } return classes; }
private static List<Class<? extends CoreAnnotation<?>>> getKeysToPrint(String columns) { if (columns == null) { columns = DEFAULT_KEYS; } String[] keyArray = columns.split(" *, *"); List<Class<? extends CoreAnnotation<?>>> keyList = new ArrayList<>(); for (String key : keyArray) { keyList.add(AnnotationLookup.toCoreKey(key)); } return keyList; }
public static Class lookupAnnotationKey(Env env, String name){ if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } // else if (obj instanceof Value) { // obj = ((Value) obj).get(); // if (obj instanceof Class) { // return (Class) obj; // } // } } } Class coreKeyClass = AnnotationLookup.toCoreKey(name); if (coreKeyClass != null) { return coreKeyClass; } else { try { Class clazz = Class.forName(name); return clazz; } catch (ClassNotFoundException ex) { return null; } } }
public static Class lookupAnnotationKey(Env env, String name) { if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } else if (obj instanceof Value) { obj = ((Value) obj).get(); if (obj instanceof Class) { return (Class) obj; } } } } return AnnotationLookup.toCoreKey(name); }
public static void annotateChunk(CoreMap chunk, Map<String,String> attributes) { for (Map.Entry<String, String> entry : attributes.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); Class coreKeyClass = AnnotationLookup.toCoreKey(key); if (key != null) { if (value != null) { try { Class valueClass = AnnotationLookup.getValueType(coreKeyClass); if (valueClass == String.class) { chunk.set(coreKeyClass, value); } else { Method valueOfMethod = valueClass.getMethod("valueOf", String.class); if (valueOfMethod != null) { chunk.set(coreKeyClass, valueOfMethod.invoke(valueClass, value)); } } } catch (Exception ex) { throw new RuntimeException("Unable to annotate attribute " + key, ex); } } else { chunk.set(coreKeyClass, null); } } else { throw new UnsupportedOperationException("Unknown null attribute."); } } }
String key = keys[i]; String value = values[i]; Class coreKeyClass = AnnotationLookup.toCoreKey(key);
@SuppressWarnings("rawtypes") public static Class[] parseStringKeys(String[] keys) { Class[] classes = new Class[keys.length]; for (int i = 0; i < keys.length; i++) { String key = keys[i]; classes[i] = AnnotationLookup.toCoreKey(key); // now work with the key we got above if (classes[i] == null) { throw new UnsupportedOperationException("Unknown key " + key); } } return classes; }
@SuppressWarnings("rawtypes") public static Class[] parseStringKeys(String[] keys) { Class[] classes = new Class[keys.length]; for (int i = 0; i < keys.length; i++) { String key = keys[i]; classes[i] = AnnotationLookup.toCoreKey(key); // now work with the key we got above if (classes[i] == null) { throw new UnsupportedOperationException("Unknown key " + key); } } return classes; }
private static List<Class<? extends CoreAnnotation<?>>> getKeysToPrint(String columns) { if (columns == null) { columns = DEFAULT_KEYS; } String[] keyArray = columns.split(" *, *"); List<Class<? extends CoreAnnotation<?>>> keyList = new ArrayList<>(); for (String key : keyArray) { keyList.add(AnnotationLookup.toCoreKey(key)); } return keyList; }
public static Class lookupAnnotationKey(Env env, String name){ if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } // else if (obj instanceof Value) { // obj = ((Value) obj).get(); // if (obj instanceof Class) { // return (Class) obj; // } // } } } Class coreKeyClass = AnnotationLookup.toCoreKey(name); if (coreKeyClass != null) { return coreKeyClass; } else { try { Class clazz = Class.forName(name); return clazz; } catch (ClassNotFoundException ex) { return null; } } }
public static Class lookupAnnotationKey(Env env, String name){ if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } // else if (obj instanceof Value) { // obj = ((Value) obj).get(); // if (obj instanceof Class) { // return (Class) obj; // } // } } } Class coreKeyClass = AnnotationLookup.toCoreKey(name); if (coreKeyClass != null) { return coreKeyClass; } else { try { Class clazz = Class.forName(name); return clazz; } catch (ClassNotFoundException ex) { return null; } } }
public static Class lookupAnnotationKey(Env env, String name) { if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } else if (obj instanceof Value) { obj = ((Value) obj).get(); if (obj instanceof Class) { return (Class) obj; } } } } return AnnotationLookup.toCoreKey(name); }
public static void annotateChunk(CoreMap chunk, Map<String,String> attributes) { for (Map.Entry<String, String> entry : attributes.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); Class coreKeyClass = AnnotationLookup.toCoreKey(key); if (key != null) { if (value != null) { try { Class valueClass = AnnotationLookup.getValueType(coreKeyClass); if (valueClass == String.class) { chunk.set(coreKeyClass, value); } else { Method valueOfMethod = valueClass.getMethod("valueOf", String.class); if (valueOfMethod != null) { chunk.set(coreKeyClass, valueOfMethod.invoke(valueClass, value)); } } } catch (Exception ex) { throw new RuntimeException("Unable to annotate attribute " + key, ex); } } else { chunk.set(coreKeyClass, null); } } else { throw new UnsupportedOperationException("Unknown null attribute."); } } }
public static Class lookupAnnotationKey(Env env, String name) { if (env != null) { Object obj = env.get(name); if (obj != null) { if (obj instanceof Class) { return (Class) obj; } else if (obj instanceof Value) { obj = ((Value) obj).get(); if (obj instanceof Class) { return (Class) obj; } } } } return AnnotationLookup.toCoreKey(name); }
public static void annotateChunk(CoreMap chunk, Map<String,String> attributes) { for (Map.Entry<String, String> entry : attributes.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); Class coreKeyClass = AnnotationLookup.toCoreKey(key); if (key != null) { if (value != null) { try { Class valueClass = AnnotationLookup.getValueType(coreKeyClass); if (valueClass == String.class) { chunk.set(coreKeyClass, value); } else { Method valueOfMethod = valueClass.getMethod("valueOf", String.class); if (valueOfMethod != null) { chunk.set(coreKeyClass, valueOfMethod.invoke(valueClass, value)); } } } catch (Exception ex) { throw new RuntimeException("Unable to annotate attribute " + key, ex); } } else { chunk.set(coreKeyClass, null); } } else { throw new UnsupportedOperationException("Unknown null attribute."); } } }
String key = keys[i]; String value = values[i]; Class coreKeyClass = AnnotationLookup.toCoreKey(key);
String key = keys[i]; String value = values[i]; Class coreKeyClass = AnnotationLookup.toCoreKey(key);