public void addGetter(Method method, SerializerGen serializer, int added, int removed) { check(method.getGenericParameterTypes().length == 0); check(isPublic(method.getModifiers())); String fieldName = stripGet(method.getName(), method.getReturnType()); check(!fields.containsKey(fieldName), "Duplicate field '%s'", method); FieldGen fieldGen = new FieldGen(); fieldGen.method = method; fieldGen.serializer = serializer; fieldGen.versionAdded = added; fieldGen.versionDeleted = removed; fieldGen.offset = lastOffset; lastOffset += getType(method.getReturnType()).getSize(); fields.put(fieldName, fieldGen); }
public void addField(Field field, SerializerGen serializer, int added, int removed) { check(implInterface || !dataTypeIn.isInterface()); check(isPublic(field.getModifiers())); String fieldName = field.getName(); check(!fields.containsKey(fieldName), "Duplicate field '%s'", field); FieldGen fieldGen = new FieldGen(); fieldGen.field = field; fieldGen.serializer = serializer; fieldGen.versionAdded = added; fieldGen.versionDeleted = removed; fieldGen.offset = lastOffset; lastOffset += getType(field.getType()).getSize(); fields.put(fieldName, fieldGen); }