本文整理汇总了Java中org.jboss.forge.roaster.model.JavaType类的典型用法代码示例。如果您正苦于以下问题:Java JavaType类的具体用法?Java JavaType怎么用?Java JavaType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaType类属于org.jboss.forge.roaster.model包,在下文中一共展示了JavaType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: applyAccessTransformation
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
/**
* Applies access transformations to a parsed type and all of its nested members.
*
* TODO: Add support for inheritance to reduce the size of AT configs.
*/
@SuppressWarnings("unchecked")
private void applyAccessTransformation(@Nonnull AccessTransformationMap transformationMap, @Nonnull JavaType classSource) {
this.getLog().info("Applying access transformations to " + classSource.getQualifiedName());
transformationMap.getTypeMappings(classSource.getQualifiedName()).ifPresent((t) -> {
if (classSource instanceof VisibilityScopedSource) {
t.getVisibility().ifPresent(((VisibilityScopedSource) classSource)::setVisibility);
}
if (classSource instanceof FieldHolderSource) {
((List<FieldSource>) ((FieldHolderSource) classSource).getFields()).forEach((f) -> t.getFieldVisibility(f.getName()).ifPresent(f::setVisibility));
}
if (classSource instanceof MethodHolderSource) {
((List<MethodSource>) ((MethodHolderSource) classSource).getMethods()).forEach((m) -> t.getMethodVisibility(m.getName()).ifPresent(m::setVisibility));
}
((List<JavaType>) classSource.getNestedClasses()).forEach((c) -> this.applyAccessTransformation(transformationMap, c));
});
}
开发者ID:BasinMC,项目名称:minecraft-maven-plugin,代码行数:26,代码来源:InitializeRepositoryMojo.java
示例2: write
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private void write(JavaType javaClass) {
try {
String dir = this.targetDir + File.separator + javaClass.getPackage().replace(".", File.separator);
Files.createDirectories(Paths.get(dir));
Path fileName = Paths.get(dir + File.separator + javaClass.getName() + ".java");
if (Files.exists(fileName)) {
System.err.println("File already exists, will be replaced: " + fileName);
}
Files.write(fileName, javaClass.toString().getBytes());
} catch (IOException e) {
log.log(Level.ERROR, "Failed to persist class", e);
}
}
开发者ID:wildfly-swarm,项目名称:wildfly-config-api,代码行数:19,代码来源:Generator.java
示例3: create
import org.jboss.forge.roaster.model.JavaType; //导入依赖的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
示例4: create
import org.jboss.forge.roaster.model.JavaType; //导入依赖的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
示例5: main
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
public static void main(String[] args) throws CoralConnectionException, FileNotFoundException {
String defaultFile = "src/main/java/edu/utah/nanofab/coralapi/CoralAPI.java";
String filename = "";
if (args.length < 1) {
System.err.println("Please pass file name, using default");
filename = defaultFile;
} else {
filename = args[0];
}
System.err.println("Decorating: " + filename);
File file = new File(filename);
if (!file.exists()) {
System.err.println("No such file");
System.exit(1);
}
JavaType jt = Roaster.parse(file);
JavaClassSource newClass = CoralAPIGenerateSynchronizedDecorator.createDecorator(jt);
System.out.println(newClass.toString());
}
开发者ID:ufabdyop,项目名称:coralapi,代码行数:20,代码来源:CreateSynchronizedDecorator.java
示例6: main
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
public static void main(String[] args) throws CoralConnectionException, FileNotFoundException {
String defaultFile = "src/main/java/edu/utah/nanofab/coralapi/CoralAPI.java";
String filename = "";
if (args.length < 1) {
System.err.println("Please pass file name, using default");
filename = defaultFile;
} else {
filename = args[0];
}
System.err.println("Decorating: " + filename);
File file = new File(filename);
if (!file.exists()) {
System.err.println("No such file");
System.exit(1);
}
JavaType jt = Roaster.parse(file);
JavaClassSource newClass = CoralAPIGenerateRetryDecorator.createDecorator(jt);
System.out.println(newClass.toString());
}
开发者ID:ufabdyop,项目名称:coralapi,代码行数:20,代码来源:CreateRetryDecorator.java
示例7: resolve
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
@Override
public String resolve(JavaType<?> source, String type)
{
GraphContext graphContext = getContext();
if (graphContext == null)
{
return type;
}
Importer<?> importer = (Importer<?>) source;
List<String> wildcardImports = new ArrayList<>();
for (Import importDeclaration : importer.getImports())
{
if (importDeclaration.isWildcard())
{
wildcardImports.add(importDeclaration.getQualifiedName());
}
}
return resolve(wildcardImports, type);
}
开发者ID:windup,项目名称:windup,代码行数:21,代码来源:WindupWildcardImportResolver.java
示例8: getAllEntities
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
@Override
public List<JavaClassSource> getAllEntities()
{
final List<JavaClassSource> result = new ArrayList<>();
JavaSourceFacet javaSourceFacet = getFaceted().getFacet(JavaSourceFacet.class);
javaSourceFacet.visitJavaSources(new JavaResourceVisitor()
{
@Override
public void visit(VisitContext context, JavaResource resource)
{
try
{
JavaType<?> type = resource.getJavaType();
if (type.hasAnnotation(Entity.class) && type.isClass())
{
result.add((JavaClassSource) type);
}
}
catch (FileNotFoundException e)
{
throw new IllegalStateException(e);
}
}
});
return result;
}
开发者ID:forge,项目名称:springboot-addon,代码行数:28,代码来源:SpringBootJPAFacet.java
示例9: apply
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
@Override
public void apply(JavaType<?> type) {
String path = getFilePath(type);
TSFile file = getFile(path);
this.currentFile = file;
TSWritable writable = transform(type);
file.add(writable);
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:9,代码来源:TSOutputProcessor.java
示例10: hasAnnotation
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
protected boolean hasAnnotation(JavaType<?> type, String simpleName) {
List<? extends Annotation<?>> annotations = type.getAnnotations();
for (Annotation<?> annotation : annotations) {
if(annotation.getName().equals(simpleName)) return true;
}
return false;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:TSOutputProcessor.java
示例11: transform
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
@Override
public TSWritable transform(JavaType<?> type) {
if(type instanceof JavaClassSource) {
return createClass((JavaClassSource) type);
} else if(type instanceof JavaInterfaceSource) {
return createInterface((JavaInterfaceSource) type);
} else if(type instanceof JavaEnumSource) {
return createEnum((JavaEnumSource) type);
}
throw new IllegalArgumentException("Unknown type: " + type.getClass().getSimpleName());
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:12,代码来源:TSModelOutput.java
示例12: createTypeName
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private TypeName createTypeName(JavaType<?> type) {
TypeName result = new CustomType(type.getName());
if(type instanceof GenericCapableSource) {
List<TypeVariableSource<?>> variables = ((GenericCapableSource) type).getTypeVariables();
for (TypeVariableSource<?> variable : variables) {
result.getGenerics().add(variable.getName());
}
}
return result;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:12,代码来源:TSModelOutput.java
示例13: createMethods
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private List<ServiceMethod> createMethods(MethodHolderSource<?> source) {
List<ServiceMethod> results = Lists.newArrayList();
for (MethodSource<?> method : source.getMethods()) {
results.add(new ServiceMethod((JavaType<?>) source, method));
}
return results;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:ServiceClass.java
示例14: createClass
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private TSClassDef createClass(ServiceClass clazz) {
JavaType<?> type = clazz.getType();
TSClassDef res = new TSClassDef();
res.name(type.getName());
res.modifier(TSModifier.EXPORT);
return res;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:TSBaseTemplate.java
示例15: ServiceMethod
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
public ServiceMethod(JavaType<?> type, MethodSource<?> method) {
this.type = type;
this.method = method;
ServiceRequestProps globalProps = createProps(type);
ServiceRequestProps methodProps = createProps(method);
this.props = methodProps.merged(globalProps);
this.params = createParams(method);
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:9,代码来源:ServiceMethod.java
示例16: parse
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
public void parse(String file) {
JavaUnit unit = Roaster.parseUnit(file);
List<JavaType<?>> types = unit.getTopLevelTypes();
for (JavaType<?> type : types) {
cache(type);
}
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:JavaTypeContainer.java
示例17: initOutputTypes
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private void initOutputTypes() {
for (Map.Entry<String, JavaType<?>> entry : javaTypes.entrySet()) {
JavaType<?> type = entry.getValue();
OutputType outputType = getOutputType(type);
if(outputType != null) outputTypes.put(type.getName(), outputType);
}
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:JavaTypeContainer.java
示例18: getOutputType
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private OutputType getOutputType(JavaType<?> type) {
for (OutputProcessor processor : processors) {
if(processor.filter(type)) {
return new OutputType(type.getName(), processor.getFilePath(type), processor.getClass());
}
}
return null;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:9,代码来源:JavaTypeContainer.java
示例19: process
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private void process(JavaType<?> type) {
for (OutputProcessor processor : processors) {
if(processor.filter(type)) {
processor.apply(type);
return;
}
}
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:9,代码来源:JavaTypeContainer.java
示例20: cache
import org.jboss.forge.roaster.model.JavaType; //导入依赖的package包/类
private void cache(JavaType<?> type) {
if(type instanceof TypeHolderSource<?>) {
List<JavaSource<?>> nested = ((TypeHolderSource<?>) type).getNestedTypes();
for (JavaSource<?> child : nested) {
cache(child);
}
}
String name = type.getName();
if(javaTypes.containsKey(name)) {
throw new IllegalStateException("Two java javaTypes defined with the same name: " + name);
}
javaTypes.put(name, type);
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:15,代码来源:JavaTypeContainer.java
注:本文中的org.jboss.forge.roaster.model.JavaType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论