fieldHash = JExpr.cast(jclass.owner().INT, fieldRef); } else if (fieldVar.type().isArray()) { if (!fieldVar.type().elementType().isPrimitive()) { throw new UnsupportedOperationException("Only primitive arrays are supported");
fieldEquals = thisFieldRef.eq(otherFieldRef); } else if (fieldVar.type().isArray()) { if (!fieldVar.type().elementType().isPrimitive()) { throw new UnsupportedOperationException("Only primitive arrays are supported");
} else if (fieldVar.type().isArray()) {
public boolean isArray() { return getRawType().isArray(); } }
private String getMethodNamePart( final JType type ) { String methodName = type.name(); if ( type.isArray() ) { methodName = methodName.replace( "[]", "s" ); } methodName = methodName.replace( ".", "" ); final char[] c = methodName.toCharArray(); c[0] = Character.toUpperCase( c[0] ); methodName = String.valueOf( c ); return methodName; }
private boolean isSizeAnnotationApplicable(JType jType) { if (jType.isArray()) return true; Class<?> clazz = loadClass(jType.fullName()); return clazz != null && (CharSequence.class.isAssignableFrom(clazz) || Collection.class.isAssignableFrom(clazz)); }
private boolean isSizeAnnotationApplicable(JType jType) { if (jType.isArray()) return true; Class<?> clazz = loadClass(jType.fullName()); return clazz != null && (CharSequence.class.isAssignableFrom(clazz) || Collection.class.isAssignableFrom(clazz)); }
private boolean isSizeAnnotationApplicable(JFieldVar field) { return field.type().name().equals("String")|| field.type().isArray() ; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
/** * Returns contents to be added to javadoc. */ protected final List<Object> listPossibleTypes( CPropertyInfo prop ) { List<Object> r = new ArrayList<Object>(); for( CTypeInfo tt : prop.ref() ) { JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED); if( t.isPrimitive() || t.isArray() ) r.add(t.fullName()); else { r.add(t); r.add("\n"); } } return r; }
@Override public JType getElementType() { if (isCollection() && !getRawType().isArray()) { return ((JClass) getRawType()).getTypeParameters().get(0); } else { return getRawType(); } }
public static JType getElementType(final FieldOutline fieldOutline) { final JFieldVar definedField = PluginUtil.getDeclaredField(fieldOutline); if (definedField != null) { if (fieldOutline.getPropertyInfo().isCollection()) { return definedField.type().isArray() ? definedField.type().elementType() : ((JClass) definedField.type()).getTypeParameters().get(0); } else { return definedField.type(); } } else { return null; } }
private JVar objectSetter( final JMethod method, final JExpression returnValue, final JFieldVar field, final boolean isNullable, final boolean isArrayNullable) { if (isNullable) { if (!isArrayNullable && field.type().isArray()) { return addObjectParameter( method, field, createAddIfNullSetEmptyArrayAndReturnClosure(this.codeModel, method, returnValue)); } return addObjectParameter(method, field); } return addObjectParameter(method, field, createEnsureArgumentNotNullClosure(this.ensurePredicateFactory, method)); } }
private void addFieldRead(Attribute attribute, JBlock body) { if ( attribute.attribute.type().isArray() ) { body.assign(attribute.attribute, cast(attribute.attribute.type(), cm.ref("AMQPArray").staticInvoke("read").arg(ref("in")))); } else if ( generator.getMapping().get(attribute.type) != null ) { body.assign(attribute.attribute, cm.ref(generator.getPrimitiveJavaClass().get(attribute.type)).staticInvoke("read").arg(ref("in"))); } else if ( generator.getProvides().contains(attribute.type) ) { } else { //body.assign(attribute.attribute, cast(attribute.attribute.type(), cm.ref(generator.getMarshaller() + ".TypeReader").staticInvoke("read").arg(ref("in")))); body.assign(attribute.attribute, cast(attribute.attribute.type(), cm.ref(generator.getMarshaller() + ".TypeReader").staticInvoke("read").arg(ref("in")))); } }
private void addFieldWrite(Attribute attribute, JBlock body) { if ( attribute.attribute.type().isArray() ) { body.staticInvoke(cm.ref("AMQPArray"), "write").arg(_this().ref(attribute.attribute.name())).arg(ref("out")); } else if ( generator.getMapping().get(attribute.type) != null ) { body.staticInvoke(cm.ref(generator.getPrimitiveJavaClass().get(attribute.type)), "write").arg(_this().ref(attribute.attribute.name())).arg(ref("out")); } else { JConditional conditional = body ._if(ref(attribute.attribute.name()).ne(_null())); conditional._then() .invoke(ref(attribute.attribute.name()), "write").arg(ref("out")); conditional._else().invoke(ref("out"), "writeByte").arg(generator.registry().cls().staticRef("NULL_FORMAT_CODE")); } }