private void addModifier0(AbstractModifier modifier, String className) { // check jvmClassName final String checkJvmClassName = JavaAssistUtils.javaNameToJvmName(className); AbstractModifier old = registry.put(checkJvmClassName, modifier); if (old != null) { throw new IllegalStateException( "Modifier already exist. className:" + checkJvmClassName + " new:" + modifier.getClass() + " old:" + old.getClass()); } }
public void addModifier(AbstractModifier modifier) { final Matcher matcher = modifier.getMatcher(); // TODO extract matcher process if (matcher instanceof ClassNameMatcher) { final ClassNameMatcher classNameMatcher = (ClassNameMatcher) matcher; String className = classNameMatcher.getClassName(); addModifier0(modifier, className); } else if (matcher instanceof MultiClassNameMatcher) { final MultiClassNameMatcher classNameMatcher = (MultiClassNameMatcher) matcher; List<String> classNameList = classNameMatcher.getClassNames(); for (String className : classNameList) { addModifier0(modifier, className); } } else { throw new IllegalArgumentException("unsupported matcher :" + matcher); } }