public static JExpression get(JExpression _this, FieldOutline fieldOutline) { final JMethod getter = getter(fieldOutline); return _this.invoke(getter); }
/** * Annotates {@link FieldOutline}. * * @param fieldOutline * @param errorHandler */ private void processFieldOutline(FieldOutline fieldOutline, ErrorHandler errorHandler) { CCustomizations customizations = CustomizationUtils.getCustomizations(fieldOutline); addSupportedAnnotation(FieldAccessorUtils.field(fieldOutline), customizations); addSupportedAnnotation(FieldAccessorUtils.getter(fieldOutline), customizations); addSupportedAnnotation(FieldAccessorUtils.setter(fieldOutline), customizations); }
public static JExpression get(FieldOutline fieldOutline) { return get(JExpr._this(), fieldOutline); }
public FieldOutline process(AnnotateOutline context, FieldOutline fieldOutline, Options options, Object attributes) { final String name = context.getMapping().getNaming() .getPropertyName(context.getMapping(), fieldOutline); logger.debug("Processing field [" + name + "]."); // Ok final JMethod issetter = FieldAccessorUtils.issetter(fieldOutline); if (issetter != null) { logger.debug("Annotating [" + issetter.name() + "] with @javax.persistence.Transient."); issetter.annotate(Transient.class); } final Object attribute = AttributesUtils.getAttribute(attributes, name); Collection<XAnnotation<?>> xannotations = context.getCreateXAnnotations() .createAttributeAnnotations(attribute); final JMethod getter = FieldAccessorUtils.getter(fieldOutline); logger.debug("Annotating the field [" + OutlineUtils.getFieldName(fieldOutline) + "]:\n" + ArrayUtils.toString(xannotations)); if (xannotations == null) { logger.error("No annotations for the field [" + OutlineUtils.getFieldName(fieldOutline) + "]:\n" + ArrayUtils.toString(xannotations)); } else { context.getApplyXAnnotations().annotate( fieldOutline.parent().ref.owner(), getter, xannotations); } return fieldOutline; }
@Override public JAnnotatable getAnnotatable(Outline outline, FieldOutline fieldOutline) { final JMethod _setter = FieldAccessorUtils.setter(fieldOutline); if (_setter == null) { throw new IllegalArgumentException( MessageFormat .format("Could not annotate the setter of the field outline [{0}], setter method could not be found.", OutlineUtils.getFieldName(fieldOutline))); } return _setter; } },
@Override public JAnnotatable getAnnotatable(Outline outline, FieldOutline fieldOutline) { // Ok final JFieldVar _field = FieldAccessorUtils.field(fieldOutline); if (_field == null) { throw new IllegalArgumentException( MessageFormat .format("Could not annotate the field of the field outline [{0}] since it could not be found.", OutlineUtils.getFieldName(fieldOutline))); } return _field; } },
public static JStatement set(FieldOutline fieldOutline, JExpression value) { return set(JExpr._this(), fieldOutline, value); }
public FieldOutline process(AnnotateOutline context, FieldOutline fieldOutline, Options options, Object attributes) { final String name = context.getMapping().getNaming() .getPropertyName(context.getMapping(), fieldOutline); logger.debug("Processing field [" + name + "]."); // Ok final JMethod issetter = FieldAccessorUtils.issetter(fieldOutline); if (issetter != null) { logger.debug("Annotating [" + issetter.name() + "] with @javax.persistence.Transient."); issetter.annotate(Transient.class); } final Object attribute = AttributesUtils.getAttribute(attributes, name); Collection<XAnnotation<?>> xannotations = context.getCreateXAnnotations() .createAttributeAnnotations(attribute); final JMethod getter = FieldAccessorUtils.getter(fieldOutline); logger.debug("Annotating the field [" + OutlineUtils.getFieldName(fieldOutline) + "]:\n" + ArrayUtils.toString(xannotations)); if (xannotations == null) { logger.error("No annotations for the field [" + OutlineUtils.getFieldName(fieldOutline) + "]:\n" + ArrayUtils.toString(xannotations)); } else { context.getApplyXAnnotations().annotate( fieldOutline.parent().ref.owner(), getter, xannotations); } return fieldOutline; }
public static JStatement set(JExpression _this, FieldOutline fieldOutline, JExpression value) { final JMethod setter = setter(fieldOutline); return _this.invoke(setter).arg(value); }
@Override protected void generateMethod(final ClassRepresentation clazz, final List<JFieldVar> includeFields, final boolean hasSuperClassFields) { final ClassOutline co = clazz.getClassOutline(); for (final FieldOutline fo : co.getDeclaredFields()) { if (fo.getRawType().fullName().startsWith(getReplaceableClass().getName())) { final JFieldVar field = FieldAccessorUtils.field(fo); final List<JClass> typeParameters = ((JClass) field.type()).getTypeParameters(); final JClass inner = typeParameters.size() > 0 ? typeParameters.get(0) : null; final JType setType = inner == null ? co.parent().getCodeModel().ref(getInterfaceClass()) : co.parent().getCodeModel().ref(getInterfaceClass()).narrow(inner); field.type(setType); if (assignOnFieldDeclaration()) { final JType classType = co.parent().getCodeModel().ref(getImplementationClass()); field.assign(JExpr._new(classType)); } replaceGetter(co, field, setType); replaceSetter(co, field, setType); } } }
public static JStatement set(FieldOutline fieldOutline, JExpression value) { return set(JExpr._this(), fieldOutline, value); }
public static JExpression get(JExpression _this, FieldOutline fieldOutline) { final JMethod getter = getter(fieldOutline); return _this.invoke(getter); }
public static JStatement set(JExpression _this, FieldOutline fieldOutline, JExpression value) { final JMethod setter = setter(fieldOutline); return _this.invoke(setter).arg(value); }
public static JExpression get(FieldOutline fieldOutline) { return get(JExpr._this(), fieldOutline); }
@Override public JAnnotatable getAnnotatable(Outline outline, FieldOutline fieldOutline) { final JMethod _getter = FieldAccessorUtils.getter(fieldOutline); if (_getter == null) { throw new IllegalArgumentException( MessageFormat .format("Could not annotate the getter of the field outline [{0}], getter method could not be found.", OutlineUtils.getFieldName(fieldOutline))); } return _getter; } },
@Override public JAnnotatable getAnnotatable(Outline outline, FieldOutline fieldOutline) { final JMethod _setter = FieldAccessorUtils.setter(fieldOutline); if (_setter == null) { throw new IllegalArgumentException( MessageFormat .format("Could not annotate the setter parameter of the field outline [{0}], setter method could not be found.", OutlineUtils.getFieldName(fieldOutline))); } else { final JVar[] params = _setter.listParams(); if (params.length != 1) { throw new IllegalArgumentException( MessageFormat .format("Could not annotate the setter parameter of the field outline [{0}], setter method must have a single parameter(this setter has {1}).", OutlineUtils.getFieldName(fieldOutline), params.length)); } else { return params[0]; } } } },
FieldAccessorUtils.get(fieldOutline));
public boolean isFieldOutlineCore(Mapping context, FieldOutline fieldOutline) { final JMethod getter = FieldAccessorUtils.getter(fieldOutline); final JType type = getter.type(); return JTypeUtils.isBasicType(type); }
public boolean isFieldOutlineCore(Mapping context, FieldOutline fieldOutline) { final JMethod getter = FieldAccessorUtils.getter(fieldOutline); final JType type = getter.type(); return JTypeUtils.isBasicType(type); }