AnnotatedFieldNameUtil { public static String getBaseName(String luceneFieldName) { int pos = luceneFieldName.indexOf(ANNOT_SEP); if (pos >= 0) { return luceneFieldName.substring(0, pos); } pos = luceneFieldName.indexOf(BOOKKEEPING_SEP); if (pos >= 0) { return luceneFieldName.substring(0, pos); } pos = luceneFieldName.indexOf(SENSITIVITY_SEP); if (pos >= 0) { throw new IllegalArgumentException("Illegal field name: " + luceneFieldName); } return luceneFieldName; } 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 testGetBaseName() { String fieldName; fieldName = AnnotatedFieldNameUtil.annotationField("field", "annotation"); Assert.assertEquals("field", AnnotatedFieldNameUtil.getBaseName(fieldName)); fieldName = AnnotatedFieldNameUtil.annotationField("field", "annotation", "sensitivity"); Assert.assertEquals("field", AnnotatedFieldNameUtil.getBaseName(fieldName)); }