本文整理匯總了Java中com.sun.codemodel.JType.isPrimitive方法的典型用法代碼示例。如果您正苦於以下問題:Java JType.isPrimitive方法的具體用法?Java JType.isPrimitive怎麽用?Java JType.isPrimitive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.codemodel.JType
的用法示例。
在下文中一共展示了JType.isPrimitive方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: definedClassOrNullFromType
import com.sun.codemodel.JType; //導入方法依賴的package包/類
private static JDefinedClass definedClassOrNullFromType(JType type)
{
if (type == null || type.isPrimitive())
{
return null;
}
JClass fieldClass = type.boxify();
JPackage jPackage = fieldClass._package();
return jPackage._getClass(fieldClass.name());
}
示例2: apply
import com.sun.codemodel.JType; //導入方法依賴的package包/類
/**
* Applies this schema rule to take the required code generation steps.
* <p>
* When this rule is applied for schemas of type object, the properties of
* the schema are used to generate a new Java class and determine its
* characteristics. See other implementers of {@link Rule} for details.
*/
@Override
public JType apply(String nodeName, JsonNode node, JPackage _package, Schema schema) {
JType superType = getSuperType(nodeName, node, _package, schema);
if (superType.isPrimitive() || isFinal(superType)) {
return superType;
}
JDefinedClass jclass;
try {
jclass = createClass(nodeName, node, _package);
} catch (ClassAlreadyExistsException e) {
return e.getExistingClass();
}
jclass._extends((JClass) superType);
schema.setJavaTypeIfEmpty(jclass);
if (node.has("deserializationClassProperty")) {
addJsonTypeInfoAnnotation(jclass, node);
}
if (node.has("title")) {
ruleFactory.getTitleRule().apply(nodeName, node.get("title"), jclass, schema);
}
if (node.has("description")) {
ruleFactory.getDescriptionRule().apply(nodeName, node.get("description"), jclass, schema);
}
ruleFactory.getPropertiesRule().apply(nodeName, node.get("properties"), jclass, schema);
if (node.has("javaInterfaces")) {
addInterfaces(jclass, node.get("javaInterfaces"));
}
ruleFactory.getAdditionalPropertiesRule().apply(nodeName, node.get("additionalProperties"), jclass, schema);
ruleFactory.getDynamicPropertiesRule().apply(nodeName, node.get("properties"), jclass, schema);
if (node.has("required")) {
ruleFactory.getRequiredArrayRule().apply(nodeName, node.get("required"), jclass, schema);
}
if (ruleFactory.getGenerationConfig().isIncludeToString()) {
addToString(jclass);
}
if (ruleFactory.getGenerationConfig().isIncludeHashcodeAndEquals()) {
addHashCode(jclass, node);
addEquals(jclass, node);
}
if (ruleFactory.getGenerationConfig().isParcelable()) {
addParcelSupport(jclass);
}
if (ruleFactory.getGenerationConfig().isIncludeConstructors()) {
addConstructors(jclass, node, schema, ruleFactory.getGenerationConfig().isConstructorsRequiredPropertiesOnly());
}
if (ruleFactory.getGenerationConfig().isSerializable()) {
SerializableHelper.addSerializableSupport(jclass);
}
return jclass;
}