本文整理汇总了Java中org.jboss.forge.roaster.model.source.JavaInterfaceSource类的典型用法代码示例。如果您正苦于以下问题:Java JavaInterfaceSource类的具体用法?Java JavaInterfaceSource怎么用?Java JavaInterfaceSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaInterfaceSource类属于org.jboss.forge.roaster.model.source包,在下文中一共展示了JavaInterfaceSource类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCRUDRepository
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
private void createCRUDRepository(JavaClassSource entitySource, Project project) {
// build interface declaration
final String name = entitySource.getName();
final String idFieldType = entitySource.getFields().stream()
.filter(field -> field.hasAnnotation(Id.class))
.findFirst()
.orElseThrow(IllegalArgumentException::new)
.getType()
.getSimpleName();
final String repoInterfaceDeclaration = "public interface " + name
+ "Repository extends PagingAndSortingRepository<"
+ name + "," + idFieldType + "> {}";
JavaInterfaceSource repoSource = Roaster.parse(JavaInterfaceSource.class, repoInterfaceDeclaration)
.setPackage(entitySource.getPackage());
repoSource.addImport("org.springframework.data.repository.PagingAndSortingRepository");
Roaster.format(repoSource.toString());
// Create Java Classes Greeting and GreetingProperties
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
facet.saveJavaSource(repoSource);
}
开发者ID:forge,项目名称:springboot-addon,代码行数:23,代码来源:CreateSpringBootJPASupportDecorator.java
示例2: create
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
/**
* Base template for a resource representation.
* Covers the resource attributes
*
* @param index
* @param plan
* @return
*/
public JavaType create(ClassIndex index, ClassPlan plan) {
// base class
JavaInterfaceSource type = Roaster.parse(
JavaInterfaceSource.class,
"public interface " + plan.getClassName() + "Supplier<T extends " + plan.getClassName() + "> {}"
);
type.setPackage(plan.getPackageName());
type.addAnnotation(FunctionalInterface.class);
addGet( type, plan );
return type;
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:25,代码来源:SupplierFactory.java
示例3: create
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
/**
* Base template for a resource representation.
* Covers the resource attributes
*
* @param index
* @param plan
* @return
*/
public JavaType create(ClassIndex index, ClassPlan plan) {
// base class
JavaInterfaceSource type = Roaster.parse(
JavaInterfaceSource.class,
"public interface " + plan.getClassName() + "Consumer<T extends " + plan.getClassName() + "<T>> {}"
);
type.setPackage(plan.getPackageName());
type.addImport(plan.getPackageName() + "." + plan.getClassName());
type.addAnnotation(FunctionalInterface.class);
addAccept(type, plan);
addAndThen(type, plan);
return type;
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:27,代码来源:ConsumerFactory.java
示例4: addAndThen
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
protected void addAndThen(JavaInterfaceSource type, ClassPlan plan) {
/*
final MethodSource<JavaInterfaceSource> method = type.addMethod();
method.addParameter( plan.getClassName() + "Consumer<T>", "after" );
method.setName("andThen")
.setBody( "return (c)->{ this.accept(c); after.accept(c); };")
.setReturnType( plan.getClassName() +"Consumer<T>" )
.setDefault(true);
*/
type.addMethod(
"default " + plan.getClassName() + "Consumer<T> andThen(" + plan.getClassName() + "Consumer<T> after) {\n"
+ " return (c)->{ this.accept(c); after.accept(c);};\n"
+ "}\n");
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:17,代码来源:ConsumerFactory.java
示例5: addComponentFactories
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
public void addComponentFactories(ComponentInfo[] componentInfos, JavaClassSource javaClass) {
String format = " %1$s.class,\n";
String code = "return new FactoryComponent[] {";
for (int i = 0; i < componentInfos.length; i++) {
ComponentInfo info = componentInfos[i];
JavaInterfaceSource interfaceSource = Roaster.parse(JavaInterfaceSource.class, String.format("public interface Factory%1$s extends FactoryComponent {}",
info.typeName));
interfaceSource.addMethod()
.setName(String.format("create%1$s", info.typeName))
.setReturnType(info.typeName)
.setPublic();
javaClass.addNestedType(interfaceSource.toString());
}
}
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:20,代码来源:ComponentIndicesGenerator.java
示例6: probe
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
/**
* Creates an implementation of the network probe. The created class extends
* {@link ExternalProbe}, setting the queuing server's connection data.
*
* @param modified
* The modified service interface
* @return The created source code
*/
public JavaClassSource probe(final JavaInterfaceSource modified) {
File file = new File(this.interfacePath);
String className = new NameProposal("NetworkLatencyProbe.java",
file.getParentFile()).getNewName();
JavaClassSource javaClass = Roaster.create(JavaClassSource.class);
// Set general properties
javaClass.setName(className);
javaClass.setPackage(modified.getPackage());
javaClass.setSuperType(ExternalProbe.class);
// Add imports
javaClass.addImport(ExternalProbe.class);
javaClass.addImport(PascaniRuntime.Context.class);
Context context = Context.PROBE;
String body = NetworkLatencyTemplates.getProbeInitialization(
this.routingKey, context);
javaClass.addMethod().setConstructor(true).setBody(body)
.addThrows(Exception.class);
return javaClass;
}
开发者ID:unicesi,项目名称:pascani,代码行数:34,代码来源:LatencyProbeGenerator.java
示例7: visit
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
public void visit(JavaSource javaSource) {
// Imports
List<Import> imports = javaSource.getImports();
for (Import javaImport : imports) {
visit(javaImport);
}
if (javaSource instanceof Body) {
visit((Body) javaSource);
} else if (javaSource instanceof JavaAnnotationSource) {
visit((JavaAnnotationSource) javaSource);
} else if (javaSource instanceof JavaClassSource) {
visit((JavaClassSource) javaSource);
} else if (javaSource instanceof JavaEnumSource) {
visit((JavaEnumSource) javaSource);
} else if (javaSource instanceof JavaInterfaceSource) {
visit((JavaInterfaceSource) javaSource);
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:21,代码来源:JavaSourceVisitor.java
示例8: addGet
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
protected void addGet(JavaInterfaceSource type, ClassPlan plan) {
final MethodSource<JavaInterfaceSource> method = type.addMethod();
method.getJavaDoc()
.setText("Constructed instance of " + plan.getClassName() + " resource")
.addTagValue("@return", "The instance");
method.setPublic()
.setName("get")
.setReturnType(plan.getClassName());
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:10,代码来源:SupplierFactory.java
示例9: addAccept
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
protected void addAccept(JavaInterfaceSource type, ClassPlan plan) {
final MethodSource<JavaInterfaceSource> method = type.addMethod();
method.getJavaDoc()
.setText("Configure a pre-constructed instance of " + plan.getClassName() + " resource")
.addTagValue("@parameter", "Instance of " + plan.getClassName() + " to configure")
.addTagValue("@return", "nothing");
method.addParameter("T", "value");
method.setName("accept")
.setReturnType("void");
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:11,代码来源:ConsumerFactory.java
示例10: filter
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
@Override
public boolean filter(JavaType<?> type) {
return hasAnnotation(type, "SharedService")
&& (type instanceof JavaInterfaceSource || type instanceof JavaClassSource);
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:6,代码来源:TSServiceOutput.java
示例11: setUpJavaSources
import org.jboss.forge.roaster.model.source.JavaInterfaceSource; //导入依赖的package包/类
@BeforeClass
public static void setUpJavaSources() throws URISyntaxException, IOException {
javaClassSource = (JavaClassSource) Roaster.parse( JavaSourceVisitorTest.class.getResource( "/org/kie/workbench/common/screens/datamodeller/backend/server/indexing/Pojo2.java" ) );
javaInterfaceSource = (JavaInterfaceSource) Roaster.parse( JavaSourceVisitorTest.class.getResource( "/org/kie/workbench/common/screens/datamodeller/backend/server/indexing/Interface2.java" ) );
javaEnumSource = (JavaEnumSource) Roaster.parse( JavaSourceVisitorTest.class.getResource( "/org/kie/workbench/common/screens/datamodeller/backend/server/indexing/Enum2.java" ) );
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:7,代码来源:JavaSourceVisitorTest.java
注:本文中的org.jboss.forge.roaster.model.source.JavaInterfaceSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论