com.sun.codemodel.JPackage._class()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(127)

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

JPackage._class介绍

[英]Add a class to this package.
[中]将类添加到此包。

代码示例

代码示例来源:origin: joelittlejohn/jsonschema2pojo

private String makeUnique(String className, JPackage _package) {
  try {
    JDefinedClass _class = _package._class(className);
    _package.remove(_class);
    return className;
  } catch (JClassAlreadyExistsException e) {
    return makeUnique(MakeUniqueClassName.makeUnique(className), _package);
  }
}

代码示例来源:origin: joelittlejohn/jsonschema2pojo

newType = _package._class(JMod.PUBLIC, getClassName(nodeName, node, _package), ClassType.CLASS);
} else {
  newType = _package._class(getClassName(nodeName, node, _package));

代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel

/**
 * Add an annotationType Declaration to this package
 * @param name
 *      Name of the annotation Type declaration to be added to this package
 * @return
 *      newly created Annotation Type Declaration
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
}

代码示例来源:origin: org.glassfish.metro/webservices-tools

/**
 * {@inheritDoc}
 * @deprecated
 */
public JDefinedClass _class( int mods, String name, boolean isInterface ) throws JClassAlreadyExistsException {
  return _class(mods,name, isInterface?ClassType.INTERFACE:ClassType.CLASS );
}

代码示例来源:origin: com.sun.codemodel/codemodel

/**
 * Add a public enum to this package
 * @param name
 *      Name of the enum to be added to this package
 * @return
 *      newly created Enum
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _enum (String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ENUM);
}
/**

代码示例来源:origin: org.glassfish.metro/webservices-tools

/**
 * Add an annotationType Declaration to this package
 * @param name
 *      Name of the annotation Type declaration to be added to this package
 * @return
 *      newly created Annotation Type Declaration
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
}

代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel

/**
 * {@inheritDoc}
 * @deprecated
 */
public JDefinedClass _class( int mods, String name, boolean isInterface ) throws JClassAlreadyExistsException {
  return _class(mods,name, isInterface?ClassType.INTERFACE:ClassType.CLASS );
}

代码示例来源:origin: com.sun.codemodel/codemodel

/**
 * Adds a public class to this package.
 */
public JDefinedClass _class(String name) throws JClassAlreadyExistsException {
  return _class( JMod.PUBLIC, name );
}

代码示例来源:origin: com.sun.codemodel/codemodel

/**
 * Add an annotationType Declaration to this package
 * @param name
 *      Name of the annotation Type declaration to be added to this package
 * @return
 *      newly created Annotation Type Declaration
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
}

代码示例来源:origin: com.sun.codemodel/codemodel

/**
 * {@inheritDoc}
 * @deprecated
 */
public JDefinedClass _class( int mods, String name, boolean isInterface ) throws JClassAlreadyExistsException {
  return _class(mods,name, isInterface?ClassType.INTERFACE:ClassType.CLASS );
}

代码示例来源:origin: javaee/jaxb-v2

/**
 * Add a public enum to this package
 * @param name
 *      Name of the enum to be added to this package
 * @return
 *      newly created Enum
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _enum (String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ENUM);
}
/**

代码示例来源:origin: sun-jaxb/jaxb-xjc

/**
 * Add an annotationType Declaration to this package
 * @param name
 *      Name of the annotation Type declaration to be added to this package
 * @return
 *      newly created Annotation Type Declaration
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
  */
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
}

代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel

/**
 * Adds a public class to this package.
 */
public JDefinedClass _class(String name) throws JClassAlreadyExistsException {
  return _class( JMod.PUBLIC, name );
}

代码示例来源:origin: javaee/jaxb-v2

/**
 * Add an annotationType Declaration to this package
 * @param name
 *      Name of the annotation Type declaration to be added to this package
 * @return
 *      newly created Annotation Type Declaration
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 
 */
public JDefinedClass _annotationTypeDeclaration(String name) throws JClassAlreadyExistsException {
  return _class (JMod.PUBLIC,name,ClassType.ANNOTATION_TYPE_DECL);
}

代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel

/**
 * Creates a new generated class.
 *
 * @exception JClassAlreadyExistsException
 *      When the specified class/interface was already created.
 */
public JDefinedClass _class(int mods, String fullyqualifiedName,ClassType t) throws JClassAlreadyExistsException {
  int idx = fullyqualifiedName.lastIndexOf('.');
  if( idx<0 )     return rootPackage()._class(fullyqualifiedName);
  else
    return _package(fullyqualifiedName.substring(0,idx))
      ._class(mods, fullyqualifiedName.substring(idx+1), t );
}

代码示例来源:origin: bonitasoft/bonita-engine

public JDefinedClass addInterface(final String fullyqualifiedName) throws JClassAlreadyExistsException {
  if (fullyqualifiedName.indexOf(".") == -1) {
    return model.rootPackage()._class(JMod.PUBLIC, fullyqualifiedName, ClassType.INTERFACE);
  }
  return model._class(fullyqualifiedName, ClassType.INTERFACE);
}

代码示例来源:origin: bonitasoft/bonita-engine

public JDefinedClass addInterface(final String fullyqualifiedName) throws JClassAlreadyExistsException {
  if (fullyqualifiedName.indexOf(".") == -1) {
    return model.rootPackage()._class(JMod.PUBLIC, fullyqualifiedName, ClassType.INTERFACE);
  }
  return model._class(fullyqualifiedName, ClassType.INTERFACE);
}

代码示例来源:origin: com.googlecode.jsonschema2pojo/jsonschema2pojo-core

private String makeUnique(String className, JPackage _package) {
  try {
    JDefinedClass _class = _package._class(className);
    _package.remove(_class);
    return className;
  } catch (JClassAlreadyExistsException e) {
    return makeUnique(className + "_", _package);
  }
}

代码示例来源:origin: org.jsonschema2pojo/jsonschema2pojo-core

private String makeUnique(String className, JPackage _package) {
  try {
    JDefinedClass _class = _package._class(className);
    _package.remove(_class);
    return className;
  } catch (JClassAlreadyExistsException e) {
    return makeUnique(MakeUniqueClassName.makeUnique(className), _package);
  }
}

代码示例来源:origin: johncarl81/transfuse

public JDefinedClass defineClass(PackageClass className) throws JClassAlreadyExistsException {
  JPackage jPackage = codeModel._package(className.getPackage());
  JDefinedClass definedClass = jPackage._class(className.getClassName());
  classGenerationStrategy.annotateGenerated(definedClass);
  definedClass.annotate(SuppressWarnings.class).paramArray("value").param("unchecked").param("deprecation");
  return definedClass;
}

相关文章