com.esotericsoftware.kryo.util.Util.getElementClass()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中com.esotericsoftware.kryo.util.Util.getElementClass()方法的一些代码示例,展示了Util.getElementClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getElementClass()方法的具体详情如下:
包路径:com.esotericsoftware.kryo.util.Util
类名称:Util
方法名:getElementClass

Util.getElementClass介绍

[英]Returns the base element type of an n-dimensional array class.
[中]返回n维数组类的基元素类型。

代码示例

代码示例来源:origin: com.esotericsoftware/kryo

  1. /** Returns true if the specified type is final. Final types can be serialized more efficiently because they are
  2. * non-polymorphic.
  3. * <p>
  4. * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively
  5. * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per
  6. * ArrayList field. */
  7. public boolean isFinal (Class type) {
  8. if (type == null) throw new IllegalArgumentException("type cannot be null.");
  9. if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers());
  10. return Modifier.isFinal(type.getModifiers());
  11. }

代码示例来源:origin: com.esotericsoftware.kryo/kryo

  1. /** Returns true if the specified type is final. Final types can be serialized more efficiently because they are
  2. * non-polymorphic.
  3. * <p>
  4. * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively
  5. * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per
  6. * ArrayList field. */
  7. public boolean isFinal (Class type) {
  8. if (type == null) throw new IllegalArgumentException("type cannot be null.");
  9. if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers());
  10. return Modifier.isFinal(type.getModifiers());
  11. }

代码示例来源:origin: com.esotericsoftware/kryo-shaded

  1. /** Returns true if the specified type is final. Final types can be serialized more efficiently because they are
  2. * non-polymorphic.
  3. * <p>
  4. * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively
  5. * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per
  6. * ArrayList field. */
  7. public boolean isFinal (Class type) {
  8. if (type == null) throw new IllegalArgumentException("type cannot be null.");
  9. if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers());
  10. return Modifier.isFinal(type.getModifiers());
  11. }

代码示例来源:origin: svn2github/kryo

  1. /** Returns true if the specified type is final. Final types can be serialized more efficiently because they are
  2. * non-polymorphic.
  3. * <p>
  4. * This can be overridden to force non-final classes to be treated as final. Eg, if an application uses ArrayList extensively
  5. * but never uses an ArrayList subclass, treating ArrayList as final could allow FieldSerializer to save 1-2 bytes per
  6. * ArrayList field. */
  7. public boolean isFinal (Class type) {
  8. if (type == null) throw new IllegalArgumentException("type cannot be null.");
  9. if (type.isArray()) return Modifier.isFinal(Util.getElementClass(type).getModifiers());
  10. return Modifier.isFinal(type.getModifiers());
  11. }

代码示例来源:origin: com.esotericsoftware/kryo

  1. /** Returns the class formatted as a string. The format varies depending on the type. */
  2. static public String className (Class type) {
  3. if (type.isArray()) {
  4. Class elementClass = getElementClass(type);
  5. StringBuilder buffer = new StringBuilder(16);
  6. for (int i = 0, n = getDimensionCount(type); i < n; i++)
  7. buffer.append("[]");
  8. return className(elementClass) + buffer;
  9. }
  10. if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class
  11. || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class
  12. || type == String.class) {
  13. return type.getSimpleName();
  14. }
  15. return type.getName();
  16. }

代码示例来源:origin: com.esotericsoftware/kryo-shaded

  1. /** Returns the class formatted as a string. The format varies depending on the type. */
  2. static public String className (Class type) {
  3. if (type.isArray()) {
  4. Class elementClass = getElementClass(type);
  5. StringBuilder buffer = new StringBuilder(16);
  6. for (int i = 0, n = getDimensionCount(type); i < n; i++)
  7. buffer.append("[]");
  8. return className(elementClass) + buffer;
  9. }
  10. if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class
  11. || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class
  12. || type == String.class) {
  13. return type.getSimpleName();
  14. }
  15. return type.getName();
  16. }

代码示例来源:origin: com.esotericsoftware.kryo/kryo

  1. /** Returns the class formatted as a string. The format varies depending on the type. */
  2. static public String className (Class type) {
  3. if (type.isArray()) {
  4. Class elementClass = getElementClass(type);
  5. StringBuilder buffer = new StringBuilder(16);
  6. for (int i = 0, n = getDimensionCount(type); i < n; i++)
  7. buffer.append("[]");
  8. return className(elementClass) + buffer;
  9. }
  10. if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class
  11. || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class
  12. || type == String.class) {
  13. return type.getSimpleName();
  14. }
  15. return type.getName();
  16. }

代码示例来源:origin: svn2github/kryo

  1. /** Returns the class formatted as a string. The format varies depending on the type. */
  2. static public String className (Class type) {
  3. if (type.isArray()) {
  4. Class elementClass = getElementClass(type);
  5. StringBuilder buffer = new StringBuilder(16);
  6. for (int i = 0, n = getDimensionCount(type); i < n; i++)
  7. buffer.append("[]");
  8. return className(elementClass) + buffer;
  9. }
  10. if (type.isPrimitive() || type == Object.class || type == Boolean.class || type == Byte.class || type == Character.class
  11. || type == Short.class || type == Integer.class || type == Long.class || type == Float.class || type == Double.class
  12. || type == String.class) {
  13. return type.getSimpleName();
  14. }
  15. return type.getName();
  16. }

相关文章