本文整理汇总了Java中org.jboss.forge.roaster.model.source.ParameterSource类的典型用法代码示例。如果您正苦于以下问题:Java ParameterSource类的具体用法?Java ParameterSource怎么用?Java ParameterSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterSource类属于org.jboss.forge.roaster.model.source包,在下文中一共展示了ParameterSource类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: paramMatchesWithProperty
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public boolean paramMatchesWithProperty(ParameterSource<JavaClassSource> param,
ObjectProperty property,
ClassTypeResolver classTypeResolver) {
if (!param.getName().equals(property.getName())) {
return false;
}
try {
return DriverUtils.equalsType(param.getType(),
property.getClassName(),
property.isMultiple(),
property.getBag(),
classTypeResolver);
} catch (Exception e) {
//TODO check if we need to propagate this exception.
logger.error("An error was produced on parameter matching test with param: " + param.getName() + " and field: " + property.getName(),
e);
return false;
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:20,代码来源:JavaRoasterModelDriver.java
示例2: paramMatchesWithPropertyType
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public boolean paramMatchesWithPropertyType(ParameterSource<JavaClassSource> param,
ObjectProperty property,
ClassTypeResolver classTypeResolver) {
try {
return DriverUtils.equalsType(param.getType(),
property.getClassName(),
property.isMultiple(),
property.getBag(),
classTypeResolver);
} catch (Exception e) {
//TODO check if we need to propagate this exception.
logger.error("An error was produced on parameter matching test with param: " + param.getName() + " and field: " + property.getName(),
e);
return false;
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:17,代码来源:JavaRoasterModelDriver.java
示例3: getAggregate
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public void getAggregate(final JavaClassSource klass) {
logger.debug("Looking for Aggregate in class " + klass.getQualifiedName());
if (!axonUtil.isAggreagte(klass)) {
return;
}
final String aggregateName = klass.getQualifiedName();
logger.info("Found aggregate in class " + klass.getQualifiedName());
eventBus.post(AggregateSpotted.builder()
.name(aggregateName)
.build());
final List<MethodSource<JavaClassSource>> methods = klass.getMethods();
for (MethodSource<JavaClassSource> method : methods) {
if (!axonUtil.isCommandHandler(method)) {
continue;
}
final ParameterSource<JavaClassSource> command = method.getParameters()
.get(0);
final Type<JavaClassSource> commandType = command.getType();
final List<String> appliedEvents = axonUtil.getAppliedEvents(method.getBody());
logger.info("Found commandhandler for command " + commandType.getName() + " in class " + klass.getQualifiedName());
eventBus.post(CommandHandlerSpotted.builder()
.command(commandType.getName())
.aggregate(aggregateName)
.events(appliedEvents)
.build());
}
}
开发者ID:Herumgeisterer,项目名称:visualaxon,代码行数:38,代码来源:AxonSpotter.java
示例4: setParamDescription
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
/**
* Sets a Swagger parameter description.
*
* @param parameterSource the parameter source information.
* @param methodParamDescriptions the map of parameter names to their descriptions.
* @param swaggerParam the Swagger parameter metadata to update.
*/
private void setParamDescription(ParameterSource<JavaClassSource> parameterSource, Map<String, String> methodParamDescriptions,
io.swagger.models.parameters.Parameter swaggerParam)
{
// Set the parameter description if one was found.
String parameterDescription = methodParamDescriptions.get(parameterSource.getName());
log.debug("Parameter \"" + parameterSource.getName() + "\" has description\"" + parameterDescription + "\".");
if (parameterDescription != null)
{
swaggerParam.setDescription(parameterDescription);
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:19,代码来源:RestControllerProcessor.java
示例5: findMatchingConstructorsByParameters
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public List<MethodSource<JavaClassSource>> findMatchingConstructorsByParameters(JavaClassSource javaClassSource,
List<ObjectProperty> properties,
ClassTypeResolver classTypeResolver) {
List<MethodSource<JavaClassSource>> result = new ArrayList<MethodSource<JavaClassSource>>();
List<MethodSource<JavaClassSource>> constructors = getConstructors(javaClassSource);
for (MethodSource<JavaClassSource> constructor : constructors) {
List<ParameterSource<JavaClassSource>> parameters = constructor.getParameters();
if (parameters == null || parameters.size() == 0 || parameters.size() != properties.size()) {
continue;
}
int unmatchedParams = parameters.size();
int paramIndex = 0;
for (ParameterSource<JavaClassSource> param : parameters) {
if (paramMatchesWithProperty(param,
properties.get(paramIndex),
classTypeResolver)) {
unmatchedParams--;
//TODO optimize to not visit all parameters, now I want to visit them all by intention
}
paramIndex++;
}
if (unmatchedParams == 0) {
result.add(constructor);
}
}
return result;
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:28,代码来源:JavaRoasterModelDriver.java
示例6: findMatchingConstructorsByTypes
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public List<MethodSource<JavaClassSource>> findMatchingConstructorsByTypes(JavaClassSource javaClassSource,
List<ObjectProperty> properties,
ClassTypeResolver classTypeResolver) {
List<MethodSource<JavaClassSource>> result = new ArrayList<MethodSource<JavaClassSource>>();
List<MethodSource<JavaClassSource>> constructors = getConstructors(javaClassSource);
for (MethodSource<JavaClassSource> constructor : constructors) {
List<ParameterSource<JavaClassSource>> parameters = constructor.getParameters();
if (parameters == null || parameters.size() == 0 || parameters.size() != properties.size()) {
continue;
}
int unmatchedParams = parameters.size();
int paramIndex = 0;
for (ParameterSource<JavaClassSource> param : parameters) {
if (paramMatchesWithPropertyType(param,
properties.get(paramIndex),
classTypeResolver)) {
unmatchedParams--;
} else {
break;
}
paramIndex++;
}
if (unmatchedParams == 0) {
result.add(constructor);
}
}
return result;
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:29,代码来源:JavaRoasterModelDriver.java
示例7: ServiceParam
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public ServiceParam(ParameterSource<?> param) {
this.param = param;
this.paramType = ServiceParamType.resolve(param);
this.props = paramType.createProps(param);
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:6,代码来源:ServiceParam.java
示例8: createParams
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
private List<ServiceParam> createParams(MethodSource<?> method) {
List<? extends ParameterSource<?>> parameters = method.getParameters();
List<ServiceParam> results = Lists.newArrayList();
parameters.forEach(p -> results.add(new ServiceParam(p)));
return results;
}
开发者ID:sdadas,项目名称:spring2ts,代码行数:7,代码来源:ServiceMethod.java
示例9: getParameters
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
@Override
public List<ParameterSource<JavaClassSource>> getParameters() {
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:5,代码来源:AnonymousMethodSource.java
示例10: addParameter
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
@Override
public ParameterSource<JavaClassSource> addParameter(Class<?> aClass, String s) {
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:5,代码来源:AnonymousMethodSource.java
示例11: removeParameter
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
@Override
public MethodSource<JavaClassSource> removeParameter(ParameterSource<JavaClassSource> parameterSource) {
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:5,代码来源:AnonymousMethodSource.java
示例12: setParameterType
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
/**
* Converts the given Java parameter type into a Swagger param type and sets it into the given Swagger param.
*
* @param parameterSource the parameter source.
* @param swaggerParam the Swagger parameter.
*/
private void setParameterType(ParameterSource<JavaClassSource> parameterSource, SerializableParameter swaggerParam) throws MojoExecutionException
{
try
{
String typeName = parameterSource.getType().getQualifiedName();
if (String.class.getName().equals(typeName))
{
swaggerParam.setType("string");
}
else if (Integer.class.getName().equals(typeName) || Long.class.getName().equals(typeName))
{
swaggerParam.setType("integer");
}
else if (Boolean.class.getName().equals(typeName))
{
swaggerParam.setType("boolean");
}
else
{
// See if the type is an enum.
Enum<?>[] enumValues = (Enum<?>[]) Class.forName(parameterSource.getType().getQualifiedName()).getEnumConstants();
if (enumValues != null)
{
swaggerParam.setType("string");
swaggerParam.setEnum(new ArrayList<>());
for (Enum<?> enumEntry : enumValues)
{
swaggerParam.getEnum().add(enumEntry.name());
}
}
else
{
// Assume "string" for all other types since everything is ultimately a string.
swaggerParam.setType("string");
}
}
log.debug("Parameter \"" + parameterSource.getName() + "\" is a type \"" + swaggerParam.getType() + "\".");
}
catch (ClassNotFoundException e)
{
throw new MojoExecutionException("Unable to instantiate class \"" + parameterSource.getType().getQualifiedName() + "\". Reason: " + e.getMessage(),
e);
}
}
开发者ID:FINRAOS,项目名称:herd,代码行数:53,代码来源:RestControllerProcessor.java
示例13: apply
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
public String apply(Object arg0) {
return ((ParameterSource<?>) arg0).getName();
}
开发者ID:unicesi,项目名称:pascani,代码行数:4,代码来源:LatencyProbeGenerator.java
示例14: isGeneratedConstructor
import org.jboss.forge.roaster.model.source.ParameterSource; //导入依赖的package包/类
/**
* @param constructor a Constructor method to check.
* @return true, if the given constructor was generated by the data modeler.
*/
public boolean isGeneratedConstructor(MethodSource<JavaClassSource> constructor) {
if (constructor.isAbstract() || constructor.isStatic() || constructor.isFinal()) {
return false;
}
if (!constructor.isPublic()) {
return false; //we only generate public constructors.
}
if (constructor.getAnnotations() != null && constructor.getAnnotations().size() > 0) {
return false; //we never add annotations to constructors
}
List<ParameterSource<JavaClassSource>> parameters = constructor.getParameters();
List<String> expectedLines = new ArrayList<String>();
String expectedLine;
if (parameters != null) {
for (ParameterSource<JavaClassSource> param : parameters) {
if (param.getAnnotations() != null && param.getAnnotations().size() > 0) {
return false; //we never add annotations to parameters
}
//ideally we should know if the parameter is final, but Roaster don't provide that info.
expectedLine = "this." + param.getName() + "=" + param.getName() + ";";
expectedLines.add(expectedLine);
}
}
String body = constructor.getBody();
if (body == null || (body = body.trim()).isEmpty()) {
return false;
}
try {
BufferedReader reader = new BufferedReader(new StringReader(body));
String line = null;
int lineNumber = 0;
while ((line = reader.readLine()) != null) {
lineNumber++;
if (lineNumber > expectedLines.size()) {
return false;
}
if (!line.trim().equals(expectedLines.get(lineNumber - 1))) {
return false;
}
}
return lineNumber == expectedLines.size();
} catch (IOException e) {
return false;
}
}
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:55,代码来源:JavaRoasterModelDriver.java
注:本文中的org.jboss.forge.roaster.model.source.ParameterSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论