public RevengPatternOutput evaluate(String input) { final Matcher matcher = pattern.matcher(input); if (matcher.find()) { String primaryName = matcher.group(namePatternType.getObjectIndex(primaryNameIndex)); String schema = getMatcherGroup(matcher, namePatternType.getSchemaIndex(primaryNameIndex)); String subSchema = getMatcherGroup(matcher, namePatternType.getSubSchemaIndex(primaryNameIndex)); // If we are looking for a subschema and only see one schema prefix, then assume it belongs to the subschema, not schema if (namePatternType.getSubSchemaIndex(primaryNameIndex) != null && schema != null && subSchema == null) { subSchema = schema; schema = null; } String secondaryName = null; if (secondaryNameIndex != null) { secondaryName = matcher.group(namePatternType.getObjectIndex(secondaryNameIndex)); if (schema == null) { schema = getMatcherGroup(matcher, namePatternType.getSchemaIndex(secondaryNameIndex)); } if (subSchema == null) { subSchema = getMatcherGroup(matcher, namePatternType.getSubSchemaIndex(secondaryNameIndex)); } // Same check as above for subschema if (namePatternType.getSubSchemaIndex(secondaryNameIndex) != null && schema != null && subSchema == null) { subSchema = schema; schema = null; } } return new RevengPatternOutput(this, primaryName, secondaryName, schema, subSchema, input); } return null; }
public RevengPatternOutput evaluate(String input) { final Matcher matcher = pattern.matcher(input); if (matcher.find()) { String primaryName = matcher.group(namePatternType.getObjectIndex(primaryNameIndex)); String schema = getMatcherGroup(matcher, namePatternType.getSchemaIndex(primaryNameIndex)); String subSchema = getMatcherGroup(matcher, namePatternType.getSubSchemaIndex(primaryNameIndex)); // If we are looking for a subschema and only see one schema prefix, then assume it belongs to the subschema, not schema if (namePatternType.getSubSchemaIndex(primaryNameIndex) != null && schema != null && subSchema == null) { subSchema = schema; schema = null; } String secondaryName = null; if (secondaryNameIndex != null) { secondaryName = matcher.group(namePatternType.getObjectIndex(secondaryNameIndex)); if (schema == null) { schema = getMatcherGroup(matcher, namePatternType.getSchemaIndex(secondaryNameIndex)); } if (subSchema == null) { subSchema = getMatcherGroup(matcher, namePatternType.getSubSchemaIndex(secondaryNameIndex)); } // Same check as above for subschema if (namePatternType.getSubSchemaIndex(secondaryNameIndex) != null && schema != null && subSchema == null) { subSchema = schema; schema = null; } } return new RevengPatternOutput(this, primaryName, secondaryName, schema, subSchema, input); } return null; }