本文整理匯總了Java中com.sun.codemodel.JDefinedClass._implements方法的典型用法代碼示例。如果您正苦於以下問題:Java JDefinedClass._implements方法的具體用法?Java JDefinedClass._implements怎麽用?Java JDefinedClass._implements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.codemodel.JDefinedClass
的用法示例。
在下文中一共展示了JDefinedClass._implements方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addParcelSupport
import com.sun.codemodel.JDefinedClass; //導入方法依賴的package包/類
private void addParcelSupport(JDefinedClass jclass) {
jclass._implements(Parcelable.class);
parcelableHelper.addWriteToParcel(jclass);
parcelableHelper.addDescribeContents(jclass);
parcelableHelper.addCreator(jclass);
parcelableHelper.addConstructorFromParcel(jclass);
// #742 : includeConstructors will include the default constructor
if (!ruleFactory.getGenerationConfig().isIncludeConstructors()) {
// Add empty constructor
jclass.constructor(JMod.PUBLIC);
}
}
示例2: buildTemplateConstraintValidator
import com.sun.codemodel.JDefinedClass; //導入方法依賴的package包/類
private JDefinedClass buildTemplateConstraintValidator(String name, JDefinedClass constraint, Class<?> param) {
try {
JClass cv = (JClass) codeModel._ref(ConstraintValidator.class);
cv = cv.narrow(constraint, (JClass) codeModel._ref(param));
JDefinedClass validator = constraint._class(JMod.STATIC | JMod.PUBLIC, name);
validator._implements(cv);
validator.method(JMod.PUBLIC, void.class, "initialize").param(constraint, "parameters");
JMethod isValid = validator.method(JMod.PUBLIC, boolean.class, "isValid");
isValid.param(Object.class, "value");
isValid.param(ConstraintValidatorContext.class, "context");
return validator;
} catch (JClassAlreadyExistsException e) {
throw new RuntimeException("Tried to create an already existing class: " + name, e);
}
}
示例3: addInterfaces
import com.sun.codemodel.JDefinedClass; //導入方法依賴的package包/類
private void addInterfaces(JDefinedClass jclass, JsonNode javaInterfaces) {
for (JsonNode i : javaInterfaces) {
jclass._implements(resolveType(jclass._package(), i.asText()));
}
}