/** * Returns constructors collection. * Creates new collection of first access. */ protected Ctors getCtors() { if (ctors == null) { ctors = new Ctors(this); } return ctors; }
/** * Returns an array of all {@link CtorDescriptor constructor descriptors}. */ public CtorDescriptor[] getAllCtorDescriptors() { return getCtors().getAllCtorDescriptors(); }
/** * Returns the default ctor or <code>null</code> if not found. */ public CtorDescriptor getDefaultCtorDescriptor(boolean declared) { CtorDescriptor defaultCtor = getCtors().getDefaultCtor(); if ((defaultCtor != null) && defaultCtor.matchDeclared(declared)) { return defaultCtor; } return null; }
/** * Returns the constructor identified by arguments or <code>null</code> if not found. */ public CtorDescriptor getCtorDescriptor(Class[] args, boolean declared) { CtorDescriptor ctorDescriptor = getCtors().getCtorDescriptor(args); if ((ctorDescriptor != null) && ctorDescriptor.matchDeclared(declared)) { return ctorDescriptor; } return null; }
public Ctors(ClassDescriptor classDescriptor) { this.classDescriptor = classDescriptor; this.allCtors = inspectConstructors(); }
/** * Inspects all declared constructors of a target type. */ protected CtorDescriptor[] inspectConstructors() { Class type = classDescriptor.getType(); Constructor[] ctors = type.getDeclaredConstructors(); CtorDescriptor[] allCtors = new CtorDescriptor[ctors.length]; for (int i = 0; i < ctors.length; i++) { Constructor ctor = ctors[i]; CtorDescriptor ctorDescriptor = createCtorDescriptor(ctor); allCtors[i] = ctorDescriptor; if (ctorDescriptor.isDefault()) { defaultCtor = ctorDescriptor; } } return allCtors; }
/** * Returns the constructor identified by arguments or <code>null</code> if not found. */ public CtorDescriptor getCtorDescriptor(final Class[] args, final boolean declared) { CtorDescriptor ctorDescriptor = getCtors().getCtorDescriptor(args); if ((ctorDescriptor != null) && ctorDescriptor.matchDeclared(declared)) { return ctorDescriptor; } return null; }
public Ctors(final ClassDescriptor classDescriptor) { this.classDescriptor = classDescriptor; this.allCtors = inspectConstructors(); }
/** * Inspects all declared constructors of a target type. */ protected CtorDescriptor[] inspectConstructors() { Class type = classDescriptor.getType(); Constructor[] ctors = type.getDeclaredConstructors(); CtorDescriptor[] allCtors = new CtorDescriptor[ctors.length]; for (int i = 0; i < ctors.length; i++) { Constructor ctor = ctors[i]; CtorDescriptor ctorDescriptor = createCtorDescriptor(ctor); allCtors[i] = ctorDescriptor; if (ctorDescriptor.isDefault()) { defaultCtor = ctorDescriptor; } } return allCtors; }
/** * Returns constructors collection. * Creates new collection of first access. */ protected Ctors getCtors() { if (ctors == null) { ctors = new Ctors(this); } return ctors; }
/** * Returns the default ctor or <code>null</code> if not found. */ public CtorDescriptor getDefaultCtorDescriptor(final boolean declared) { CtorDescriptor defaultCtor = getCtors().getDefaultCtor(); if ((defaultCtor != null) && defaultCtor.matchDeclared(declared)) { return defaultCtor; } return null; }
/** * Returns an array of all {@link CtorDescriptor constructor descriptors}. */ public CtorDescriptor[] getAllCtorDescriptors() { return getCtors().getAllCtorDescriptors(); }
/** * Returns the constructor identified by arguments or <code>null</code> if not found. */ public CtorDescriptor getCtorDescriptor(final Class[] args, final boolean declared) { CtorDescriptor ctorDescriptor = getCtors().getCtorDescriptor(args); if ((ctorDescriptor != null) && ctorDescriptor.matchDeclared(declared)) { return ctorDescriptor; } return null; }
public Ctors(final ClassDescriptor classDescriptor) { this.classDescriptor = classDescriptor; this.allCtors = inspectConstructors(); }
/** * Inspects all declared constructors of a target type. */ protected CtorDescriptor[] inspectConstructors() { Class type = classDescriptor.getType(); Constructor[] ctors = type.getDeclaredConstructors(); CtorDescriptor[] allCtors = new CtorDescriptor[ctors.length]; for (int i = 0; i < ctors.length; i++) { Constructor ctor = ctors[i]; CtorDescriptor ctorDescriptor = createCtorDescriptor(ctor); allCtors[i] = ctorDescriptor; if (ctorDescriptor.isDefault()) { defaultCtor = ctorDescriptor; } } return allCtors; }
/** * Returns constructors collection. * Creates new collection of first access. */ protected Ctors getCtors() { if (ctors == null) { ctors = new Ctors(this); } return ctors; }
/** * Returns the default ctor or <code>null</code> if not found. */ public CtorDescriptor getDefaultCtorDescriptor(final boolean declared) { CtorDescriptor defaultCtor = getCtors().getDefaultCtor(); if ((defaultCtor != null) && defaultCtor.matchDeclared(declared)) { return defaultCtor; } return null; }
/** * Returns an array of all {@link CtorDescriptor constructor descriptors}. */ public CtorDescriptor[] getAllCtorDescriptors() { return getCtors().getAllCtorDescriptors(); }
package p2; import p1.Ctors; public class SubCtors { public SubCtors() { new Ctors(); } }