/** * Gets all the {@link FieldOutline}s newly declared * in this class. */ public final FieldOutline[] getDeclaredFields() { List<CPropertyInfo> props = target.getProperties(); FieldOutline[] fr = new FieldOutline[props.size()]; for( int i=0; i<fr.length; i++ ) fr[i] = parent().getField(props.get(i)); return fr; }
/** * Gets all the {@link FieldOutline}s newly declared * in this class. */ public final FieldOutline[] getDeclaredFields() { List<CPropertyInfo> props = target.getProperties(); FieldOutline[] fr = new FieldOutline[props.size()]; for( int i=0; i<fr.length; i++ ) fr[i] = parent().getField(props.get(i)); return fr; }
/** * Gets all the {@link FieldOutline}s newly declared * in this class. */ public final FieldOutline[] getDeclaredFields() { List<CPropertyInfo> props = target.getProperties(); FieldOutline[] fr = new FieldOutline[props.size()]; for( int i=0; i<fr.length; i++ ) fr[i] = parent().getField(props.get(i)); return fr; }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); }
/** * Gets the {@link Options} in the current compilation context. */ protected final Options getOptions() { return parent().parent().getModel().options; }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); } }
/** * Returns the super class of this class, if it has the * super class and it is also a JAXB-bound class. * Otherwise null. */ public final ClassOutline getSuperClass() { CClassInfo s = target.getBaseClass(); if(s==null) return null; return parent().getClazz(s); }
/** * Gets the {@link Options} in the current compilation context. */ protected final Options getOptions() { return parent().parent().getModel().options; }
/** * {@link PackageOutline} that contains this class. */ public @NotNull PackageOutline _package() { return parent().getPackageContext(ref._package()); }
private boolean isFieldTypeContainer(JType type, ClassOutline classOutline) { if (type instanceof JDefinedClass) { return isContainer((JDefinedClass) type, classOutline.parent()); } else if (isList(type)) { JClass clazz = (JClass) type; return isFieldTypeContainer(clazz.getTypeParameters().get(0), classOutline); } return false; }
public void createEntity$Class(Mapping context, ClassOutline classOutline, final Entity entity) { if (entity.getClazz() == null || "##default".equals(entity.getClazz())) { entity.setClazz(context.getNaming().getEntityClass(context, classOutline.parent(), classOutline.target)); } }
public void createEntity$Name(Mapping context, ClassOutline classOutline, final Entity entity) { if (entity.getName() == null || "##default".equals(entity.getName())) { entity.setName(context.getNaming().getEntityName(context, classOutline.parent(), classOutline.target)); } }
public void createOneToOne$TargetEntity(Mapping context, FieldOutline fieldOutline, final OneToOne oneToOne) { final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Collection<? extends CTypeInfo> types = context.getGetTypes() .process(context, propertyInfo); assert types.size() == 1; final CTypeInfo type = types.iterator().next(); assert type instanceof CClass; final CClass childClassInfo = (CClass) type; oneToOne.setTargetEntity(context.getNaming().getEntityClass(context, fieldOutline.parent().parent(), childClassInfo.getType())); }
public boolean isFieldOutlineCore2(Mapping context, FieldOutline fieldOutline) { final CTypeInfo type = getCommonBaseTypeInfo(context, fieldOutline); assert type != null; return JTypeUtils.isBasicType(type.toType(fieldOutline.parent() .parent(), Aspect.EXPOSED)); }
private JExpression getEnumLeafInfoCopyExpression( final FieldOutline fieldOutline, final CEnumLeafInfo type, final JBlock block, final JExpression sourceExpr ) { block.directStatement( "// CEnumLeafInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); return sourceExpr; }
private JExpression getAdapterInfoCopyExpression( final FieldOutline fieldOutline, final CAdapterInfo type, final JBlock block, final JExpression source ) { block.directStatement( "// CAdapterInfo: " + type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ).binaryName() ); final JType jType = type.toType( fieldOutline.parent().parent(), Aspect.IMPLEMENTATION ); return JExpr.cast( jType, this.getCopyOfObjectInvocation( fieldOutline.parent() ).arg( source ) ); }
public static String getGetterMethodName(ClassOutline classOutline, JFieldVar field) { CPropertyInfo prop = classOutline.target.getProperty(field.name()); JType type = field.type(); Options options = classOutline.parent().getModel().options; JCodeModel codeModel = classOutline.parent().getCodeModel(); if (options.enableIntrospection) { return ((type.isPrimitive() && type.boxify().getPrimitiveType() == codeModel.BOOLEAN) ? "is" : "get") + prop.getName(true); } else { return (type.boxify().getPrimitiveType() == codeModel.BOOLEAN ? "is" : "get") + prop.getName(true); } }
public void createManyToMany$TargetEntity(Mapping context, FieldOutline fieldOutline, final ManyToMany manyToMany) { final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Collection<? extends CTypeInfo> types = context.getGetTypes() .process(context, propertyInfo); final CTypeInfo type = CTypeInfoUtils.getCommonBaseTypeInfo(types); assert type != null; assert type instanceof CClass; final CClass childClassInfo = (CClass) type; manyToMany.setTargetEntity(context.getNaming().getEntityClass(context, fieldOutline.parent().parent(), childClassInfo.getType())); }
private void generateNameOnlyMetaField(final PluginContext pluginContext, final JDefinedClass metaClass, final FieldOutline fieldOutline) { final PropertyOutline propertyOutline = new DefinedPropertyOutline(fieldOutline); final String constantName = getConstantName(fieldOutline); final Outline outline = pluginContext.outline; final String propertyName = constantName != null ? constantName : propertyOutline.getFieldName(); final String metaFieldName = this.camelCase ? propertyName : fieldOutline.parent().parent().getModel().getNameConverter().toConstantName(propertyName); metaClass.field(JMod.PUBLIC | JMod.STATIC | JMod.FINAL | JMod.TRANSIENT, String.class, metaFieldName, JExpr.lit(propertyName)); }
public void createOneToMany$TargetEntity(Mapping context, FieldOutline fieldOutline, final OneToMany oneToMany) { final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); final Collection<? extends CTypeInfo> types = context.getGetTypes() .process(context, propertyInfo); final CTypeInfo type = CTypeInfoUtils.getCommonBaseTypeInfo(types); assert type != null; assert type instanceof CClass; final CClass childClassInfo = (CClass) type; oneToMany.setTargetEntity(context.getNaming().getEntityClass(context, fieldOutline.parent().parent(), childClassInfo.getType())); }