AnnotatedFieldNameUtil { public static String annotationField(String fieldName, String annotName, String sensitivityName) { String fieldAnnotName; boolean annotGiven = annotName != null && annotName.length() > 0; if (!annotGiven) { throw new IllegalArgumentException("Must specify a annotation name"); } if (fieldName == null || fieldName.length() == 0) { fieldAnnotName = annotName; } else { fieldAnnotName = fieldName + ANNOT_SEP + annotName; } if (sensitivityName == null || sensitivityName.length() == 0) { return fieldAnnotName; } return fieldAnnotName + SENSITIVITY_SEP + sensitivityName; } private  AnnotatedFieldNameUtil(); static BookkeepFieldType whichBookkeepingSubfield(String bookkeepName); static String contentIdField(String fieldName); static String forwardIndexIdField(String annotFieldName); static String lengthTokensField(String fieldName); static String tagAnnotationField(String fieldName); static String annotationField(String fieldName, String annotName, String sensitivityName); static String annotationField(String fieldName, String annotName); static String annotationSensitivity(String fieldAnnotName, String sensitivityName); static String[] getNameComponents(String luceneFieldName); static String getBaseName(String luceneFieldName); static String getDefaultMainAnnotationName(); static MatchSensitivity sensitivity(String luceneField); static boolean isAnnotatedField(String luceneFieldName); static boolean isValidXmlElementName(String name); static String sanitizeXmlElementName(String name); static String sanitizeXmlElementName(String name, String replaceChar); static final String FORWARD_INDEX_ID_BOOKKEEP_NAME; static final String TAGS_ANNOT_NAME; static final String WORD_ANNOT_NAME; static final String PUNCTUATION_ANNOT_NAME; static final String LEMMA_ANNOT_NAME; static final String SUBANNOTATION_FIELD_PREFIX_SEPARATOR; static final String SUBANNOTATION_SEPARATOR; }
@Test public void testAnnotatedFieldName() { Assert.assertEquals("field" + AnnotatedFieldNameUtil.ANNOT_SEP + "annotation", AnnotatedFieldNameUtil.annotationField("field", "annotation")); Assert.assertEquals("field" + AnnotatedFieldNameUtil.ANNOT_SEP + "annotation" + AnnotatedFieldNameUtil.SENSITIVITY_SEP + "sensitivity", AnnotatedFieldNameUtil.annotationField("field", "annotation", "sensitivity")); Assert.assertEquals("test" + AnnotatedFieldNameUtil.ANNOT_SEP + "word" + AnnotatedFieldNameUtil.SENSITIVITY_SEP + "s", AnnotatedFieldNameUtil.annotationField("test", "word", "s")); Assert.assertEquals("hw" + AnnotatedFieldNameUtil.SENSITIVITY_SEP + "s", AnnotatedFieldNameUtil.annotationField(null, "hw", "s")); }