/** * This should only be called for non-public constructors. This method forces a * private accessor to be generated for the constructor. * * @param constructor * A non-public constructor. * @return A statement for invoking the given constructor. */ public ContextualStatementBuilder exposedConstructorStmt(final MetaConstructor constructor, final Statement... params) { addExposedConstructor(constructor); return invokeStatic(factory, getPrivateMethodName(constructor), (Object[]) params); }
/** * For public methods, fields, constructors, and parameters of public methods, * this method does nothing. Otherwise this method generates private * accessors/mutators. In the case of a parameter this method acts as if * called for the declaring method. * * This method is idempotent. * * @param annotated * A method, field, or parameter that may or may not be public. */ public void ensureMemberExposed(final HasAnnotations annotated) { final MetaClassMember member; if (annotated instanceof MetaParameter) { member = ((MetaParameter) annotated).getDeclaringMember(); } else { member = (MetaClassMember) annotated; } if (!member.isPublic()) { if (member instanceof MetaField) { addExposedField((MetaField) member); } else if (member instanceof MetaMethod) { addExposedMethod((MetaMethod) member); } else if (member instanceof MetaConstructor) { addExposedConstructor((MetaConstructor) member); } } }