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

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

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

Util.className介绍

[英]Returns the class formatted as a string. The format varies depending on the type.
[中]返回格式化为字符串的类。格式因类型而异。

代码示例

代码示例来源:origin: apache/metron

@Override
 public Object newInstance () {
  try {
   return constructor.newInstance();
  } catch (Exception ex) {
   throw new KryoException("Error constructing instance of class: " + className(type), ex);
  }
 }
};

代码示例来源:origin: apache/metron

@Override
 public Object newInstance () {
  try {
   return constructor.newInstance();
  } catch (Exception ex) {
   throw new KryoException("Error constructing instance of class: " + className(type), ex);
  }
 }
};

代码示例来源:origin: apache/metron

@Override
 public Object newInstance () {
  try {
   return access.newInstance();
  } catch (Exception ex) {
   throw new KryoException("Error constructing instance of class: " + className(type), ex);
  }
 }
};

代码示例来源:origin: apache/metron

@Override
 public Object newInstance () {
  try {
   return access.newInstance();
  } catch (Exception ex) {
   throw new KryoException("Error constructing instance of class: " + className(type), ex);
  }
 }
};

代码示例来源:origin: apache/metron

throw new KryoException("Class cannot be created (non-static member class): " + className(type));
else
 throw new KryoException("Class cannot be created (missing no-arg constructor): " + className(type));

代码示例来源:origin: apache/metron

throw new KryoException("Class cannot be created (non-static member class): " + className(type));
else
 throw new KryoException("Class cannot be created (missing no-arg constructor): " + className(type));

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

protected String unregisteredClassMessage (Class type) {
  return "Class is not registered: " + className(type) + "\nNote: To register this class use: kryo.register("
    + className(type) + ".class);";
}

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

public String toString () {
    return "[" + id + ", " + className(type) + "]";
  }
}

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

public String toString () {
    return "[" + id + ", " + className(type) + "]";
  }
}

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

public String toString () {
    return "[" + id + ", " + className(type) + "]";
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

protected void checkIncorrectClass(Class type) {
  if (type != null && !Serializable.class.isAssignableFrom(type)) {
    throw new IllegalArgumentException(String.format("Class is not registered: %s\nNote: To register this class use: kryo.register(\"%s\".class);",
        Util.className(type), Util.className(type)));
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

protected void checkIncorrectObject(T object) {
    if (object != null && !(object instanceof Serializable)) {
      String className = Util.className(object.getClass());
      throw new IllegalArgumentException(String.format("Class is not registered: %s\nNote: To register this class use: kryo.register(\"%s\".class);",
          className, className));
    }
  }
}

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

/** Returns the object formatted as a string. The format depends on the object's type and whether {@link Object#toString()} has
 * been overridden. */
static public String string (Object object) {
  if (object == null) return "null";
  Class type = object.getClass();
  if (type.isArray()) return className(type);
  try {
    if (type.getMethod("toString", new Class[0]).getDeclaringClass() == Object.class)
      return TRACE ? className(type) : type.getSimpleName();
  } catch (Exception ignored) {
  }
  return String.valueOf(object);
}

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

public Object newInstance () {
    try {
      return constructor.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

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

public Object newInstance () {
    try {
      return constructor.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

代码示例来源:origin: com.twitter/chill-java

@Override
public void apply(Kryo k) {
 try {
  k.register(klass, serializerKlass.newInstance());
 } catch (Exception ex) {
  throw new IllegalArgumentException("Unable to create serializer \"" + serializerKlass.getName() + "\" for class: "
      + Util.className(klass), ex);
 }
}
@Override

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

public Object newInstance () {
    try {
      return constructor.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

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

public Object newInstance () {
    try {
      return access.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

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

public Object newInstance () {
    try {
      return access.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

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

public Object newInstance () {
    try {
      return access.newInstance();
    } catch (Exception ex) {
      throw new KryoException("Error constructing instance of class: " + className(type), ex);
    }
  }
};

相关文章