/** Returns true if the specified type is final. Final types can be serialized more efficiently because they are * non-polymorphic. * <p> * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per * ArrayList field. */ public boolean isFinal (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers()); return Modifier.isFinal(type.getModifiers()); }
/** Returns true if the specified type is final. Final types can be serialized more efficiently because they are * non-polymorphic. * <p> * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per * ArrayList field. */ public boolean isFinal (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers()); return Modifier.isFinal(type.getModifiers()); }
/** Returns true if the specified type is final. Final types can be serialized more efficiently because they are * non-polymorphic. * <p> * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per * ArrayList field. */ public boolean isFinal (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers()); return Modifier.isFinal(type.getModifiers()); }
/** Returns true if the specified type is final. Final types can be serialized more efficiently because they are * non-polymorphic. * <p> * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per * ArrayList field. */ public boolean isFinal (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers()); return Modifier.isFinal(type.getModifiers()); }
/** Returns the class formatted as a string. The format varies depending on the type. */ static public String className (Class type) { if (type.isArray()) { Class elementClass = getElementClass(type); StringBuilder buffer = new StringBuilder(16); for (int i = 0, n = getDimensionCount(type); i < n; i++) buffer.append("[]"); return className(elementClass) + buffer; } if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) { return type.getSimpleName(); } return type.getName(); }
/** Returns the class formatted as a string. The format varies depending on the type. */ static public String className (Class type) { if (type.isArray()) { Class elementClass = getElementClass(type); StringBuilder buffer = new StringBuilder(16); for (int i = 0, n = getDimensionCount(type); i < n; i++) buffer.append("[]"); return className(elementClass) + buffer; } if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) { return type.getSimpleName(); } return type.getName(); }
/** Returns the class formatted as a string. The format varies depending on the type. */ static public String className (Class type) { if (type.isArray()) { Class elementClass = getElementClass(type); StringBuilder buffer = new StringBuilder(16); for (int i = 0, n = getDimensionCount(type); i < n; i++) buffer.append("[]"); return className(elementClass) + buffer; } if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) { return type.getSimpleName(); } return type.getName(); }
/** Returns the class formatted as a string. The format varies depending on the type. */ static public String className (Class type) { if (type.isArray()) { Class elementClass = getElementClass(type); StringBuilder buffer = new StringBuilder(16); for (int i = 0, n = getDimensionCount(type); i < n; i++) buffer.append("[]"); return className(elementClass) + buffer; } if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class || type == String.class) { return type.getSimpleName(); } return type.getName(); }