String (PatternCondition<?> condition) { if (!(condition instanceof PatternConditionPlus)) return null; final ElementPattern valuePattern = ((PatternConditionPlus<?, ?>)condition).getValuePattern(); final ElementPatternCondition<?> rootCondition = valuePattern.getCondition(); if (!String.class.equals(rootCondition.getInitialCondition().getAcceptedClass())) return null; if (rootCondition.getConditions().size() != 1) return null; final PatternCondition<?> valueCondition = rootCondition.getConditions().get(0); if (!(valueCondition instanceof ValuePatternCondition<?>)) return null; final Collection values = ((ValuePatternCondition)valueCondition).getValues(); if (values.size() == 1) { final Object value = values.iterator().next(); return value instanceof String? (String)value : null; } else if (!values.isEmpty()) { for (Object value : values) { if (!(value instanceof String)) return null; } //noinspection unchecked return StringUtil.join(values, "|"); } return null; }