public boolean isArrayElement() { return tail.isArrayElement(); }
public boolean isArrayElement() { return tail.isArrayElement(); }
private static String isNull(Property property, String name) { if (property == null) { return name + " == null"; } else { String getterNull = getGetter(property, name) + " == null"; if (property.isListElement()) { return "(" + unwrap(getGetter(property, name)) + ".size() <= " + property.getName().replaceAll("[\\[\\]]", "") + " || " + getterNull + ")"; } else if (property.isArrayElement()) { return "(" + unwrap(getGetter(property, name)) + ".length <= " + property.getName().replaceAll("[\\[\\]]", "") + " || " + getterNull + ")"; } else { return getterNull; } } }
/** * Returns a fully type-cast setter for the property which has no reliance * on java generics. * * @param property * the Property for which to return the getter * @param variableExpression * the String value to use for the variable on which the getter * is called * @return */ protected static String getSetter(final Property property, final String variableExpression) { if (property.getSetter() == null) return null; String var = variableExpression; if (property.hasPath()) { for (final Property p : property.getPath()) { var = getGetter(p, var); } } return var + (property.isArrayElement() || "".equals(property.getName()) || property.getSetter().startsWith("[") ? "" : ".") + property.getSetter(); }
private static String isNull(Property property, String name) { if (property == null) { return name + " == null"; } else { String getterNull = getGetter(property, name) + " == null"; if (property.isListElement()) { return "(" + unwrap(getGetter(property, name)) + ".size() <= " + property.getName().replaceAll("[\\[\\]]", "") + " || " + getterNull + ")"; } else if (property.isArrayElement()) { return "(" + unwrap(getGetter(property, name)) + ".length <= " + property.getName().replaceAll("[\\[\\]]", "") + " || " + getterNull + ")"; } else { return getterNull; } } }
/** * Returns a fully type-cast setter for the property which has no reliance * on java generics. * * @param property * the Property for which to return the getter * @param variableExpression * the String value to use for the variable on which the getter * is called * @return */ protected static String getSetter(final Property property, final String variableExpression) { if (property.getSetter() == null) return null; String var = variableExpression; if (property.hasPath()) { for (final Property p : property.getPath()) { var = getGetter(p, var); } } return var + (property.isArrayElement() || "".equals(property.getName()) || property.getSetter().startsWith("[") ? "" : ".") + property.getSetter(); }
protected static String getGetter(final Property property, String variableExpression) { if (property.getGetter() == null) return null; String var = variableExpression; if (property.hasPath()) { for (final Property p : property.getPath()) { var = getGetter(p, var); } } String getter = "((" + property.getType().getCanonicalName() + ")" + var; if (!property.isArrayElement() && !"".equals(property.getName()) && !property.getGetter().startsWith("[")) { getter += "." + property.getGetter() + ")"; } else { getter += property.getGetter() + ")"; } return getter; }
public String generateMappingCode(FieldMap fieldMap, VariableRef source, VariableRef destination, SourceCodeContext code) { LOGGER.debug("PrimitiveAndObject condition occurred; context: " + "\nsrc: " + source.property() + "\nsrc.isArrayElement: " + source.property().isArrayElement() + "\nsrc.isListElement: " + source.property().isListElement() + "\nsrc.isMapKey: " + source.property().isMapKey() + "\ndest: " + destination.property() + "\ndest.isArrayElement: " + destination.property().isArrayElement() + "\ndest.isListElement: " + destination.property().isListElement() + "\ndest.isMapKey: " + destination.property().isMapKey() ); throw new MappingException("Encountered mapping of primitive to object (or vise-versa); sourceType="+ source.type() + ", destinationType=" + destination.type()); }
protected static String getGetter(final Property property, String variableExpression) { if (property.getGetter() == null) return null; String var = variableExpression; if (property.hasPath()) { for (final Property p : property.getPath()) { var = getGetter(p, var); } } String getter = "((" + property.getType().getCanonicalName() + ")" + var; if (!property.isArrayElement() && !"".equals(property.getName()) && !property.getGetter().startsWith("[")) { getter += "." + property.getGetter() + ")"; } else { getter += property.getGetter() + ")"; } return getter; }
public boolean appliesTo(FieldMap fieldMap) { return (fieldMap.getSource().isMapKey() || fieldMap.getSource().isArrayElement() || fieldMap.getSource().isListElement()) && (TypeFactory.TYPE_OF_OBJECT.equals(fieldMap.getSource().getType())); }
public boolean appliesTo(FieldMap fieldMap) { return (fieldMap.getDestination().isMapKey() || fieldMap.getDestination().isArrayElement() || fieldMap.getDestination().isListElement()) && (TypeFactory.TYPE_OF_OBJECT.equals(fieldMap.getDestination().getType())); }
public boolean apply(FieldMap fieldMap) { return (fieldMap.getSource().isListElement() || fieldMap.getSource().isArrayElement()) && (fieldMap.getDestination().getType().isImmutable() || (!fieldMap.getDestination().isCollection() && !fieldMap.getDestination().isArray() && !fieldMap.getDestination().isMap() && !fieldMap.getDestination() .isEnum())); } };
public boolean apply(FieldMap fieldMap) { return (fieldMap.getDestination().isListElement() || fieldMap.getDestination().isArrayElement()) && (fieldMap.getSource().getType().isImmutable() || (!fieldMap.getSource().isCollection() && !fieldMap.getSource().isArray() && !fieldMap.getSource().isMap() && !fieldMap.getSource().isEnum())); } };
public boolean apply(FieldMap fieldMap) { return (fieldMap.getDestination().isListElement() || fieldMap.getDestination().isArrayElement()) && (ClassUtil.isImmutable(fieldMap.getSource().getType()) || (!fieldMap.getSource().isCollection() && !fieldMap.getSource().isArray() && !fieldMap.getSource().isMap() && !fieldMap.getSource().isEnum())); } };
public boolean apply(FieldMap fieldMap) { return (fieldMap.getSource().isListElement() || fieldMap.getSource().isArrayElement()) && (ClassUtil.isImmutable(fieldMap.getDestination().getType()) || (!fieldMap.getDestination().isCollection() && !fieldMap.getDestination().isArray() && !fieldMap.getDestination().isMap() && !fieldMap.getDestination() .isEnum())); } };
public boolean appliesTo(FieldMap fieldMap) { return (fieldMap.getDestination().isMapKey() || fieldMap.getDestination().isArrayElement() || fieldMap.getDestination().isListElement()) && (ClassUtil.isImmutable(fieldMap.getSource().getType()) || (!fieldMap.getSource().isCollection() && !fieldMap.getSource().isArray() && !fieldMap.getSource().isMap() && !fieldMap.getSource() .isEnum())); }
public boolean appliesTo(FieldMap fieldMap) { return (fieldMap.getSource().isMapKey() || fieldMap.getSource().isArrayElement() || fieldMap.getSource().isListElement()) && (ClassUtil.isImmutable(fieldMap.getDestination().getType()) || (!fieldMap.getDestination().isCollection() && !fieldMap.getDestination().isArray() && !fieldMap.getDestination().isMap() && !fieldMap.getDestination() .isEnum())); }