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

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

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

JPackage._interface介绍

[英]Add an interface to this package.
[中]将接口添加到此包。

代码示例

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

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

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

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

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

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

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

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

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

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

代码示例来源:origin: phoenixnap/springmvc-raml-plugin

@Override
public JDefinedClass apply(ApiResourceMetadata controllerMetadata, JPackage generatableType) {
  String controllerClassName = controllerMetadata.getResourceName().concat("Client");
  JDefinedClass definedClass;
  try {
    definedClass = generatableType._interface(controllerClassName);
  } catch (JClassAlreadyExistsException e1) {
    definedClass = generatableType._getClass(controllerClassName);
  }
  return definedClass;
}

代码示例来源:origin: mulesoft-labs/raml-jaxrs-codegen

public JDefinedClass createResourceInterface(final String name) throws Exception
{
  String actualName;
  int i = -1;
  while (true)
  {
    actualName = name + (++i == 0 ? "" : Integer.toString(i));
    if (!resourcesMethods.containsKey(actualName))
    {
      resourcesMethods.put(actualName, new HashSet<String>());
      break;
    }
  }
  final JPackage pkg = codeModel._package(configuration.getBasePackageName() + ".resource");
  return pkg._interface(actualName);
}

代码示例来源:origin: phoenixnap/springmvc-raml-plugin

@Override
public JDefinedClass apply(ApiResourceMetadata controllerMetadata, JPackage generatableType) {
  String controllerClassName = controllerMetadata.getName() + CONTROLLER_SUFFIX;
  JDefinedClass definedClass;
  try {
    definedClass = generatableType._interface(controllerClassName);
  } catch (JClassAlreadyExistsException e1) {
    definedClass = generatableType._getClass(controllerClassName);
  }
  return definedClass;
}

代码示例来源:origin: phoenixnap/springmvc-raml-plugin

@Override
public JDefinedClass apply(ApiResourceMetadata controllerMetadata, JPackage generatableType) {
  String clientClassName = controllerMetadata.getName() + CLIENT_SUFFIX;
  JDefinedClass definedClass;
  try {
    definedClass = generatableType._interface(clientClassName);
  } catch (JClassAlreadyExistsException e1) {
    definedClass = generatableType._getClass(clientClassName);
  }
  return definedClass;
}

代码示例来源:origin: org.raml/raml-jaxrs-codegen-core

/**
 * <p>createResourceInterface.</p>
 *
 * @param name a {@link java.lang.String} object.
 * @return a {@link com.sun.codemodel.JDefinedClass} object.
 * @throws java.lang.Exception if any.
 */
public JDefinedClass createResourceInterface(final String name) throws Exception
{
  String actualName;
  int i = -1;
  while (true)
  {
    actualName = name + (++i == 0 ? "" : Integer.toString(i));
    if (!resourcesMethods.containsKey(actualName))
    {
      resourcesMethods.put(actualName, new HashSet<String>());
      break;
    }
  }
  final JPackage pkg = codeModel._package(configuration.getBasePackageName() + "." +configuration.getRestIFPackageName());
  return pkg._interface(actualName);
}

代码示例来源:origin: jenkinsci/maven-hpi-plugin

JDefinedClass c = pkg.parent()._interface(StringUtils.capitalize(h2j(dir.getName())) + "TagLib");
c._implements(TypedTagLibrary.class);
c.annotate(TagLibraryUri.class).param("value",dirName);

代码示例来源:origin: mklemm/jaxb2-rich-contract-plugin

final JDefinedClass supportInterface;
try {
  groupInterface = container._interface(JMod.PUBLIC, interfaceName);
  supportInterface = this.settings.isGeneratingSupportInterface() ? container._interface(JMod.PUBLIC, interfaceName + this.settings.getSupportInterfaceNameSuffix())._implements(groupInterface) : null;
} catch (final JClassAlreadyExistsException e) {
  this.pluginContext.errorHandler.error(new SAXParseException(MessageFormat.format(GroupInterfaceGenerator.RESOURCE_BUNDLE.getString("error.interface-exists"), interfaceName, ""), groupDecl.getLocator()));

代码示例来源:origin: io.konig/konig-schemagen

public JDefinedClass buildDataWriterInterface() throws SchemaGeneratorException {
  
  JDefinedClass dc;
  try {
    dc = writerPackage._interface("DataWriter");
    
    JClass objectType = model.ref(Object.class);
    dc.method(0, String.class, "getMediaType");
    
    JMethod method = dc.method(0, void.class, "write");
    method.param(objectType, "data");
    method.param(dataSinkClass, "out");
    
    JClass ioException = model.ref(IOException.class);
    
    method._throws(validationExceptionClass);
    method._throws(ioException);
    
    return dc;
  } catch (JClassAlreadyExistsException e) {
    throw new SchemaGeneratorException(e);
  }
  
}

相关文章