private JMethod addStandardConstructor(final JDefinedClass clazz, FieldOutline[] declaredFields, FieldOutline[] superclassFields) { JMethod ctor = clazz.getConstructor(NO_ARGS); if (ctor == null) { ctor = this.generateStandardConstructor(clazz, declaredFields, superclassFields); } else { this.log(Level.WARNING, "standardCtorExists"); } return ctor; }
private JMethod getStandardConstructor( final ClassOutline clazz ) { JMethod ctor = clazz.implClass.getConstructor( NO_ARGS ); if ( ctor == null ) { ctor = this.generateStandardConstructor( clazz ); } else { this.log( Level.WARNING, "standardCtorExists", clazz.implClass.binaryName() ); } return ctor; }
private Object addPropertyContructor(JDefinedClass clazz, FieldOutline[] declaredFields, FieldOutline[] superclassFields, int constAccess) { JMethod ctor = clazz.getConstructor(getFieldTypes(declaredFields, superclassFields)); if (ctor == null) { ctor = this.generatePropertyConstructor(clazz, declaredFields, superclassFields, constAccess); } else { this.log(Level.WARNING, "standardCtorExists"); } return ctor; }
private JMethod getCopyConstructor( final ClassOutline clazz ) { JMethod ctor = clazz.implClass.getConstructor( new JType[] { clazz.implClass } ); if ( ctor == null ) { ctor = this.generateCopyConstructor( clazz ); } else { this.log( Level.WARNING, "copyCtorExists", clazz.implClass.binaryName() ); } return ctor; }
/** * Return the <code>JavaConstructor</code> for this <code>JavaClass</code> that has the * provided parameter types. * * @param parameterTypes the parameter list used to identify the constructor. * * @return the <code>JavaConstructor</code> with the signature matching parameterTypes. */ public JavaConstructor getConstructor(JavaClass[] parameterTypes) { JType[] xjcParameterTypes = new JType[parameterTypes.length]; for (int i = 0; i < parameterTypes.length; i++) { JavaClass pType = parameterTypes[i]; String className = pType.getQualifiedName(); JType xjcType = null; if (pType.isPrimitive()) { xjcType = jPrimitiveTypes.get(className); } else { xjcType = jCodeModel._getClass(className); } xjcParameterTypes[i] = xjcType; } JMethod constructor = xjcClass.getConstructor(xjcParameterTypes); return new XJCJavaConstructorImpl(constructor, jCodeModel, dynamicClassLoader, this); }