本文整理汇总了Java中com.sun.codemodel.internal.JDefinedClass类的典型用法代码示例。如果您正苦于以下问题:Java JDefinedClass类的具体用法?Java JDefinedClass怎么用?Java JDefinedClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JDefinedClass类属于com.sun.codemodel.internal包,在下文中一共展示了JDefinedClass类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeGetPort
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
private void writeGetPort(Port port, JType retType, JDefinedClass cls) {
JMethod m = cls.method(JMod.PUBLIC, retType, port.getPortGetter());
JDocComment methodDoc = m.javadoc();
if (port.getJavaDoc() != null) {
methodDoc.add(port.getJavaDoc());
}
JCommentPart ret = methodDoc.addReturn();
JCommentPart paramDoc = methodDoc.addParam("features");
paramDoc.append("A list of ");
paramDoc.append("{@link " + WebServiceFeature.class.getName() + "}");
paramDoc.append("to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.");
ret.add("returns " + retType.name());
m.varParam(WebServiceFeature.class, "features");
JBlock body = m.body();
StringBuilder statement = new StringBuilder("return ");
statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), ");
statement.append(retType.name());
statement.append(".class, features);");
body.directStatement(statement.toString());
writeWebEndpoint(port, m);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ServiceGenerator.java
示例2: writeDefaultGetPort
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
private void writeDefaultGetPort(Port port, JType retType, JDefinedClass cls) {
String portGetter = port.getPortGetter();
JMethod m = cls.method(JMod.PUBLIC, retType, portGetter);
JDocComment methodDoc = m.javadoc();
if (port.getJavaDoc() != null) {
methodDoc.add(port.getJavaDoc());
}
JCommentPart ret = methodDoc.addReturn();
ret.add("returns " + retType.name());
JBlock body = m.body();
StringBuilder statement = new StringBuilder("return ");
statement.append("super.getPort(new QName(\"").append(port.getName().getNamespaceURI()).append("\", \"").append(port.getName().getLocalPart()).append("\"), ");
statement.append(retType.name());
statement.append(".class);");
body.directStatement(statement.toString());
writeWebEndpoint(port, m);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ServiceGenerator.java
示例3: writeMember
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
private void writeMember(JDefinedClass cls, TypeMirror paramType,
String paramName) {
if (cls == null)
return;
String accessorName =BindingHelper.mangleNameToPropertyName(paramName);
String getterPrefix = paramType.toString().equals("boolean")? "is" : "get";
JType propType = getType(paramType);
JMethod m = cls.method(JMod.PUBLIC, propType, getterPrefix+ accessorName);
JDocComment methodDoc = m.javadoc();
JCommentPart ret = methodDoc.addReturn();
ret.add("returns "+propType.name());
JBlock body = m.body();
body._return( JExpr._this().ref(paramName) );
m = cls.method(JMod.PUBLIC, cm.VOID, "set"+accessorName);
JVar param = m.param(propType, paramName);
methodDoc = m.javadoc();
JCommentPart part = methodDoc.addParam(paramName);
part.add("the value for the "+ paramName+" property");
body = m.body();
body.assign( JExpr._this().ref(paramName), param );
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:WebServiceWrapperGenerator.java
示例4: generateClassDef
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private ClassOutlineImpl generateClassDef(CClassInfo bean) {
ImplStructureStrategy.Result r = model.strategy.createClasses(this, bean);
JClass implRef;
if (bean.getUserSpecifiedImplClass() != null) {
// create a place holder for a user-specified class.
JDefinedClass usr;
try {
usr = codeModel._class(bean.getUserSpecifiedImplClass());
// but hide that file so that it won't be generated.
usr.hide();
} catch (JClassAlreadyExistsException e) {
// it's OK for this to collide.
usr = e.getExistingClass();
}
usr._extends(r.implementation);
implRef = usr;
} else {
implRef = r.implementation;
}
return new ClassOutlineImpl(this, bean, r.exposed, r.implementation, implRef);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:BeanGenerator.java
示例5: generateEnumDef
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
/**
* Generates the minimum {@link JDefinedClass} skeleton
* without filling in its body.
*/
private EnumOutline generateEnumDef(CEnumLeafInfo e) {
JDefinedClass type;
type = getClassFactory().createClass(
getContainer(e.parent, EXPOSED), e.shortName, e.getLocator(), ClassType.ENUM);
type.javadoc().append(e.javadoc);
return new EnumOutline(e, type) {
@Override
public
@NotNull
Outline parent() {
return BeanGenerator.this;
}
};
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:BeanGenerator.java
示例6: run
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
public boolean run(
Outline outline,
Options opt,
ErrorHandler errorHandler ) {
for( ClassOutline ci : outline.getClasses() ) {
JDefinedClass impl = ci.implClass;
if (ci.getSuperClass() == null) {
JVar $loc = impl.field(JMod.PROTECTED, Locator.class, fieldName);
$loc.annotate(XmlLocation.class);
$loc.annotate(XmlTransient.class);
impl._implements(Locatable.class);
impl.method(JMod.PUBLIC, Locator.class, "sourceLocation").body()._return($loc);
JMethod setter = impl.method(JMod.PUBLIC, Void.TYPE, "setSourceLocation");
JVar $newLoc = setter.param(Locator.class, "newLocator");
setter.body().assign($loc, $newLoc);
}
}
return true;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:SourceLocationAddOn.java
示例7: getTypeUse
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
public TypeUse getTypeUse(XSSimpleType owner) {
if(typeUse!=null)
return typeUse;
JCodeModel cm = getCodeModel();
JDefinedClass a;
try {
a = cm._class(adapter);
a.hide(); // we assume this is given by the user
a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
cm.ref(type)));
} catch (JClassAlreadyExistsException e) {
a = e.getExistingClass();
}
// TODO: it's not correct to say that it adapts from String,
// but OTOH I don't think we can compute that.
typeUse = TypeUseFactory.adapt(
CBuiltinLeafInfo.STRING,
new CAdapter(a));
return typeUse;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:BIConversion.java
示例8: getSuperClass
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
/** Gets the xjc:superClass customization if it's turned on. */
public JClass getSuperClass() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superClass");
if (sc == null) return null;
JDefinedClass c;
try {
String v = DOMUtil.getAttribute(sc,"name");
if(v==null) return null;
c = codeModel._class(v);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:BindInfo.java
示例9: getSuperInterface
import com.sun.codemodel.internal.JDefinedClass; //导入依赖的package包/类
/** Gets the xjc:superInterface customization if it's turned on. */
public JClass getSuperInterface() {
Element sc = DOMUtil.getElement(dom,XJC_NS,"superInterface");
if (sc == null) return null;
String name = DOMUtil.getAttribute(sc,"name");
if (name == null) return null;
JDefinedClass c;
try {
c = codeModel._class(name, ClassType.INTERFACE);
c.hide();
} catch (JClassAlreadyExistsException e) {
c = e.getExistingClass();
}
return c;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:BindInfo.java
注:本文中的com.sun.codemodel.internal.JDefinedClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论