本文整理了Java中com.sun.codemodel.JType.fullName()
方法的一些代码示例,展示了JType.fullName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JType.fullName()
方法的具体详情如下:
包路径:com.sun.codemodel.JType
类名称:JType
方法名:fullName
[英]Gets the full name of the type. See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.
[中]
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private String getListType(JType jType) {
final String typeName = jType.fullName();
return substringBeforeLast(substringAfter(typeName, "<"), ">");
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private boolean isFinal(JType superType) {
try {
Class<?> javaClass = Class.forName(superType.fullName());
return Modifier.isFinal(javaClass.getModifiers());
} catch (ClassNotFoundException e) {
return false;
}
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private boolean isString(JType type){
return type.fullName().equals(String.class.getName());
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private static void processFieldVarForSerializableSupport(JFieldVar fieldVar, DataOutputStream dataOutputStream) throws IOException {
dataOutputStream.writeUTF(fieldVar.name());
dataOutputStream.writeInt(fieldVar.mods().getValue());
JType type = fieldVar.type();
dataOutputStream.writeUTF(type.fullName());
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
if (fieldType.fullName().equals(String.class.getName())) {
return JExpr.lit(node.asText());
} else if (fieldType.fullName().equals(int.class.getName())) {
return JExpr.lit(Integer.parseInt(node.asText()));
} else if (fieldType.fullName().equals(BigInteger.class.getName())) {
return JExpr._new(fieldType).arg(JExpr.lit(node.asText()));
} else if (fieldType.fullName().equals(double.class.getName())) {
return JExpr.lit(Double.parseDouble(node.asText()));
} else if (fieldType.fullName().equals(BigDecimal.class.getName())) {
return JExpr._new(fieldType).arg(JExpr.lit(node.asText()));
} else if (fieldType.fullName().equals(boolean.class.getName())) {
return JExpr.lit(Boolean.parseBoolean(node.asText()));
} else if (fieldType.fullName().equals(DateTime.class.getName()) || fieldType.fullName().equals(Date.class.getName())) {
long millisecs = parseDateToMillisecs(node.asText());
} else if (fieldType.fullName().equals(LocalDate.class.getName()) || fieldType.fullName().equals(LocalTime.class.getName())) {
} else if (fieldType.fullName().equals(long.class.getName())) {
return JExpr.lit(Long.parseLong(node.asText()));
} else if (fieldType.fullName().equals(float.class.getName())) {
return JExpr.lit(Float.parseFloat(node.asText()));
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private static void processMethodCollectionForSerializableSupport(Iterator<JMethod> methods, DataOutputStream dataOutputStream) throws IOException {
TreeMap<String, JMethod> sortedMethods = new TreeMap<>();
while (methods.hasNext()) {
JMethod method = methods.next();
//Collect non-private methods
if ((method.mods().getValue() & JMod.PRIVATE) != JMod.PRIVATE) {
sortedMethods.put(method.name(), method);
}
}
for (JMethod method : sortedMethods.values()) {
dataOutputStream.writeUTF(method.name());
dataOutputStream.writeInt(method.mods().getValue());
if (method.type() != null) {
dataOutputStream.writeUTF(method.type().fullName());
}
for (JVar param : method.params()) {
dataOutputStream.writeUTF(param.type().fullName());
}
}
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
@Override
public void dateTimeField(JFieldVar field, JDefinedClass clazz, JsonNode node) {
String timezone = node.has("customTimezone") ? node.get("customTimezone").asText() : "UTC";
String pattern = null;
if (node.has("customDateTimePattern")) {
pattern = node.get("customDateTimePattern").asText();
} else if (node.has("customPattern")) {
pattern = node.get("customPattern").asText();
} else if (isNotEmpty(getGenerationConfig().getCustomDateTimePattern())) {
pattern = getGenerationConfig().getCustomDateTimePattern();
} else if (getGenerationConfig().isFormatDateTimes()) {
pattern = FormatRule.ISO_8601_DATETIME_FORMAT;
}
if (pattern != null && !field.type().fullName().equals("java.lang.String")) {
field.annotate(JsonFormat.class).param("shape", JsonFormat.Shape.STRING).param("pattern", pattern).param("timezone", timezone);
}
}
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
@Override
public void dateField(JFieldVar field, JDefinedClass clazz, JsonNode node) {
String pattern = null;
if (node.has("customDatePattern")) {
pattern = node.get("customDatePattern").asText();
} else if (node.has("customPattern")) {
pattern = node.get("customPattern").asText();
} else if (isNotEmpty(getGenerationConfig().getCustomDatePattern())) {
pattern = getGenerationConfig().getCustomDatePattern();
} else if (getGenerationConfig().isFormatDates()) {
pattern = FormatRule.ISO_8601_DATE_FORMAT;
}
if (pattern != null && !field.type().fullName().equals("java.lang.String")) {
field.annotate(JsonFormat.class).param("shape", JsonFormat.Shape.STRING).param("pattern", pattern);
}
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
@Override
public void timeField(JFieldVar field, JDefinedClass clazz, JsonNode node) {
String pattern = null;
if (node.has("customTimePattern")) {
pattern = node.get("customTimePattern").asText();
} else if (node.has("customPattern")) {
pattern = node.get("customPattern").asText();
} else if (isNotEmpty(getGenerationConfig().getCustomTimePattern())) {
pattern = getGenerationConfig().getCustomTimePattern();
} else if (getGenerationConfig().isFormatDates()) {
pattern = FormatRule.ISO_8601_TIME_FORMAT;
}
if (pattern != null && !field.type().fullName().equals("java.lang.String")) {
field.annotate(JsonFormat.class).param("shape", JsonFormat.Shape.STRING).param("pattern", pattern);
}
}
代码示例来源:origin: joelittlejohn/jsonschema2pojo
String fieldType = field.type().fullName();
代码示例来源:origin: joelittlejohn/jsonschema2pojo
private JInvocation illegalArgumentInvocation(JDefinedClass jclass, String propertyName, JType propertyType, JVar valueVar) {
return _new(jclass.owner()._ref(IllegalArgumentException.class))
.arg(lit("property \"" + propertyName + "\" is of type \"" + propertyType.fullName() + "\", but got ")
.plus(valueVar.invoke("getClass").invoke("toString")));
}
代码示例来源:origin: com.sun.codemodel/codemodel
/**
* Gets the binary name of the type.
*
* See http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#44909
*
* @return
* Name like "Foo$Bar", "int", "java.lang.String", "java.io.File[]". Never null.
*/
public String binaryName() {
return fullName();
}
代码示例来源:origin: javaee/jaxb-v2
/**
* Gets the binary name of the type.
*
* See http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#44909
*
* @return
* Name like "Foo$Bar", "int", "java.lang.String", "java.io.File[]". Never null.
*/
public String binaryName() {
return fullName();
}
代码示例来源:origin: org.jvnet.jaxb2_commons/jaxb2-basics-tools
public JCMType(JCMTypeFactory factory, JT type) {
this.factory = Validate.notNull(factory);
this.type = Validate.notNull(type);
this.fullName = type.fullName();
}
代码示例来源:origin: apache/cxf
private void writeDefaultType(Writer writer, JType t, String path) throws IOException {
String name = t.fullName();
writeDefaultType(writer, name, path);
}
private void writeDefaultType(Writer writer, String name, String path) throws IOException {
代码示例来源:origin: org.jvnet.jaxbcommons/jaxbcommons-core
public int compare(Object o1, Object o2) {
final TypeItem t1 = (TypeItem) o1;
final TypeItem t2 = (TypeItem) o2;
return t1.getType().fullName().compareTo(t2.getType().fullName());
}
};
代码示例来源:origin: net.anwiba.commons.tools/anwiba-tools-generator-bean
public static boolean isInstanceOfList(final JType type) {
try {
final String className = withoutGenerics(type.fullName());
final Class<?> clazz = Class.forName(className);
return java.util.List.class.isAssignableFrom(clazz);
} catch (final ClassNotFoundException exception) {
return false;
}
}
代码示例来源:origin: org.objectweb.celtix/celtix-tools
private JavaReturn getReturnFromProperty(Property property, Part part) {
JType t = property.type();
String targetNamespace = ProcessorUtil.resolvePartNamespace(part);
if (targetNamespace == null) {
targetNamespace = property.elementName().getNamespaceURI();
}
JavaReturn returnType = new JavaReturn(property.name(), t.fullName(), targetNamespace);
returnType.setQName(property.elementName());
returnType.setStyle(JavaType.Style.OUT);
return returnType;
}
代码示例来源:origin: Evolveum/midpoint
private void createFluentFieldMethods(JFieldVar field, ClassOutline targetClass, ClassOutline fieldsFromClass) {
print("createFluentFieldMethods for " + field.name() + " on " + targetClass.implClass.fullName() + " (from " + fieldsFromClass.implClass.fullName() + ")");
JMethod fluentSetter = createFluentSetter(field, targetClass, fieldsFromClass);
createMethodStringVersion(field, targetClass, fluentSetter);
// FIXME ugly hack - we create beginXYZ only for our own structures
// TODO not for all!
JType basicType = getContentType(field);
if (basicType.fullName().startsWith("com.evolveum.") && isInstantiable(basicType)) {
createFluentBegin(field, targetClass, fieldsFromClass, fluentSetter);
}
}
代码示例来源:origin: org.jsonschema2pojo/jsonschema2pojo-core
private JInvocation illegalArgumentInvocation(JDefinedClass jclass, String propertyName, JType propertyType, JVar valueVar) {
return _new(jclass.owner()._ref(IllegalArgumentException.class))
.arg(lit("property \"" + propertyName + "\" is of type \"" + propertyType.fullName() + "\", but got ")
.plus(valueVar.invoke("getClass").invoke("toString")));
}
内容来源于网络,如有侵权,请联系作者删除!