// and as above, can't access private ones
public ValueInstantiator createOptimized()
    {
        /* [Issue#11]: Need to avoid optimizing if we use delegate- or
         *  property-based creators.
         */
        if (_originalInstantiator.canCreateFromObjectWith()
                || _originalInstantiator.canCreateUsingDelegate()) {
            return null;
        }
        // for now, only consider need to handle default creator
        AnnotatedWithParams defaultCreator = _originalInstantiator.getDefaultCreator();
        if (defaultCreator != null) {
            AnnotatedElement elem = defaultCreator.getAnnotated();
            if (elem instanceof Constructor<?>) {
                // First things first: as per [Issue#34], can NOT access private ctors or methods
                Constructor<?> ctor = (Constructor<?>) elem;
                if (!Modifier.isPrivate(ctor.getModifiers())) {
                    return createSubclass(ctor, null).with(_originalInstantiator);
                }
            } else if (elem instanceof Method) {
                Method m = (Method) elem;
                int mods = m.getModifiers();
                // and as above, can't access private ones
                if (Modifier.isStatic(mods) && !Modifier.isPrivate(mods)) {
                    return createSubclass(null, m).with(_originalInstantiator);
                }
            }
        }
        return null;
    }
Method m = (Method) elem;
int mods = m.getModifiers();
// and as above, can't access private ones
if (Modifier.isStatic(mods) && !Modifier.isPrivate(mods)) {
return createSubclass(null, m).with(_originalInstantiator);
AnnotatedElement elem = defaultCreator.getAnnotated();
if (elem instanceof Constructor<?>) {
// First things first: as per [Issue#34], can NOT access private ctors or methods
Constructor<?> ctor = (Constructor<?>) elem;
if (!Modifier.isPrivate(ctor.getModifiers())) {
return createSubclass(ctor, null).with(_originalInstantiator);
}
} else if (elem instanceof Method) {
Method m = (Method) elem;
int mods = m.getModifiers();
// and as above, can't access private ones
if (Modifier.isStatic(mods) && !Modifier.isPrivate(mods)) {
return createSubclass(null, m).with(_originalInstantiator);
}
}
}
return null;
}
/* [Issue#11]: Need to avoid optimizing if we use delegate- or
* property-based creators.
*/
if (_originalInstantiator.canCreateFromObjectWith()
|| _originalInstantiator.canCreateUsingDelegate()) {
return null;
}
// for now, only consider need to handle default creator
AnnotatedWithParams defaultCreator = _originalInstantiator.getDefaultCreator();
if (defaultCreator != null) {
AnnotatedElement elem = defaultCreator.getAnnotated();
if (elem instanceof Constructor<?>) {
// First things first: as per [Issue#34], can NOT access private ctors or methods
Constructor<?> ctor = (Constructor<?>) elem;
if (!Modifier.isPrivate(ctor.getModifiers())) {
return createSubclass(ctor, null).with(_originalInstantiator);
}
} else if (elem instanceof Method) {
Method m = (Method) elem;
int mods = m.getModifiers();
// and as above, can't access private ones
if (Modifier.isStatic(mods) && !Modifier.isPrivate(mods)) {
return createSubclass(null, m).with(_originalInstantiator);
}
}
}
return null;
}