本文整理汇总了Java中org.kie.workbench.common.services.refactoring.ResourceReference.addPartReference方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceReference.addPartReference方法的具体用法?Java ResourceReference.addPartReference怎么用?Java ResourceReference.addPartReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kie.workbench.common.services.refactoring.ResourceReference
的用法示例。
在下文中一共展示了ResourceReference.addPartReference方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
private void visit(final Characteristic c) {
//Add type
final String typeName = c.getFact();
final String fullyQualifiedClassName = getFullyQualifiedClassName(typeName);
ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
ResourceType.JAVA);
//Add field
final String fieldName = c.getField();
final String fieldFullyQualifiedClassName = getFieldFullyQualifiedClassName(fullyQualifiedClassName,
fieldName);
resRef.addPartReference(fieldName,
PartType.FIELD);
addResourceReference(fieldFullyQualifiedClassName,
ResourceType.JAVA);
}
示例2: addField
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
private String addField(final String fieldName,
final String fullyQualifiedClassName) {
final ModelField[] mfs = dmo.getModuleModelFields().get(fullyQualifiedClassName);
if (mfs != null) {
for (ModelField mf : mfs) {
if (mf.getName().equals(fieldName)) {
// add the type of the field owner and the field reference
ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
ResourceType.JAVA);
resRef.addPartReference(fieldName,
PartType.FIELD);
// add the type of the field
addResourceReference(mf.getClassName(),
ResourceType.JAVA);
return mf.getClassName();
}
}
}
return null;
}
示例3: visitSingleFieldConstraint
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
private void visitSingleFieldConstraint(final SingleFieldConstraint sfc) {
ResourceReference resRef = addResourceReference(getFullyQualifiedClassName(sfc.getFactType()),
ResourceType.JAVA);
resRef.addPartReference(sfc.getFieldName(),
PartType.FIELD);
addResourceReference(getFullyQualifiedClassName(sfc.getFieldType()),
ResourceType.JAVA);
if (sfc.getConnectives() != null) {
for (int i = 0; i < sfc.getConnectives().length; i++) {
visit(sfc.getConnectives()[i]);
}
}
}
示例4: visitConnectiveConstraint
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
private void visitConnectiveConstraint(final ConnectiveConstraint cc) {
ResourceReference resRef = addResourceReference(getFullyQualifiedClassName(cc.getFactType()),
ResourceType.JAVA);
resRef.addPartReference(cc.getFieldName(),
PartType.FIELD);
addResourceReference(getFullyQualifiedClassName(cc.getFieldType()),
ResourceType.JAVA);
}
示例5: visit
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
private void visit(final String fullyQualifiedClassName,
final ActionFieldValue afv) {
ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
ResourceType.JAVA);
resRef.addPartReference(afv.getField(),
PartType.FIELD);
addResourceReference(getFullyQualifiedClassName(afv.getType()),
ResourceType.JAVA);
}
示例6: visit
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
public void visit() {
if (enumLoader.hasErrors()) {
logger.error("Errors when indexing " + resourcePath.toAbsolutePath().toFile().getAbsolutePath());
return;
}
for (Map.Entry<String, String[]> e : enumLoader.getData().entrySet()) {
//Add type
final String typeName = getTypeName(e.getKey());
final String fullyQualifiedClassName = getFullyQualifiedClassName(typeName);
//Add field
final String fieldName = getFieldName(e.getKey());
final String fieldFullyQualifiedClassName = getFieldFullyQualifiedClassName(fullyQualifiedClassName,
fieldName);
//If either type or field could not be resolved log a warning
if (fullyQualifiedClassName == null) {
logger.warn("Index entry will not be created for '" + e.getKey() + "'. Unable to determine FQCN for '" + typeName + "'. ");
} else {
ResourceReference resRef = addResourceReference(fullyQualifiedClassName,
ResourceType.JAVA);
if (fieldFullyQualifiedClassName == null) {
logger.warn("Index entry will not be created for '" + e.getKey() + "'. Unable to determine FQCN for '" + typeName + "." + fieldName + "'. ");
} else {
resRef.addPartReference(fieldName,
PartType.FIELD);
addResourceReference(fieldFullyQualifiedClassName,
ResourceType.JAVA);
}
}
}
}
示例7: visit
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
protected void visit(final EnumDeclarationDescr descr) {
String typeName = getPackagePrefix() + descr.getFullTypeName();
ResourceReference enumLocalRef = addResourceReference(typeName,
ResourceType.DRL_ENUM);
for (EnumLiteralDescr enumLitDescr : descr.getLiterals()) {
enumLocalRef.addPartReference(enumLitDescr.getName(),
PartType.DRL_ENUM_VAL);
visitAnnos(enumLitDescr);
}
visitAnnos(descr);
}
示例8: addResourceReferences
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
/**
* Used by the Visitor implemenation to add multiple {@link ResourceReference} instances at once.
* @param collector A {@link ResourceReferenceCollector} containing information about the asset being indexed.
*/
public void addResourceReferences(ResourceReferenceCollector collector) {
if( collector.referencedResourcesMap != null ) {
Map<String, ResourceReference> refResMap = internalGetResourceReferences();
for( Entry<String, ResourceReference> resRefEntry : collector.referencedResourcesMap.entrySet() ) {
ResourceReference newResRef = resRefEntry.getValue();
ResourceReference existingResRef = refResMap.put(resRefEntry.getKey(), newResRef);
if( existingResRef != null ) {
newResRef.addPartReference(existingResRef.getPartReferences());
}
}
}
}
示例9: visit
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
public void visit(AnnotationSource<? extends JavaClassSource> annoSource) {
if (annoSource.getQualifiedName().equals(AssetsUsageServiceImplTest.REFERENCED)) {
ResourceReference reference = addResourceReference(annoSource.getStringValue("resourceFQN"),
ResourceType.JAVA);
reference.addPartReference(annoSource.getStringValue("part"),
PartType.FIELD);
}
}
示例10: visitProperty
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
protected void visitProperty(ResourceReference reference,
FormDefinition formDefinition,
ModelProperty property) {
addResourceReference(property.getTypeInfo().getClassName(),
ResourceType.JAVA);
FieldDefinition field = formDefinition.getFieldByBoundProperty(property);
if (field != null) {
reference.addPartReference(property.getName(),
PartType.VARIABLE);
}
}
示例11: process
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
@Override
public void process(DefaultIndexBuilder builder,
JavaType javaType) {
try {
final List<Annotation> comparatorDefinitions;
Annotation planningEntityAnnotation = javaType.getAnnotation(PlanningEntity.class.getName());
if (planningEntityAnnotation == null) {
return;
}
String difficultyComparatorClass = planningEntityAnnotation.getStringValue("difficultyComparatorClass");
if (difficultyComparatorClass != null && javaType instanceof JavaClassSource && difficultyComparatorClass.matches("\\w[\\.\\w]+\\.class")) {
String[] difficultyComparatorTokens = difficultyComparatorClass.split("\\.");
comparatorDefinitions = ((JavaClassSource) javaType).getNestedTypes().stream()
.filter(t -> t instanceof JavaClassSource
&& t.getName().equals(difficultyComparatorTokens[difficultyComparatorTokens.length - 2])
&& t.getAnnotation(ComparatorDefinition.class.getName()) != null
&& t.getAnnotation(Generated.class.getName()) != null
&& ((JavaClassSource) t).getInterfaces().stream().anyMatch(i -> i.startsWith(Comparator.class.getName())))
.map(t -> t.getAnnotation(ComparatorDefinition.class.getName()))
.collect(Collectors.toList());
} else {
return;
}
if (javaType.getSyntaxErrors() == null || javaType.getSyntaxErrors().isEmpty()) {
for (Annotation comparatorDefinition : comparatorDefinitions) {
Annotation[] fieldPathDefinitions = comparatorDefinition.getAnnotationArrayValue("objectPropertyPaths");
String previousFullyQualifiedClassname = null;
if (fieldPathDefinitions != null) {
for (Annotation fieldPathDefinition : fieldPathDefinitions) {
Annotation[] fieldDefinitions = fieldPathDefinition.getAnnotationArrayValue("objectProperties");
if (fieldDefinitions != null && fieldDefinitions.length > 0) {
previousFullyQualifiedClassname = fieldDefinitions[0].getStringValue("type");
if (previousFullyQualifiedClassname != null && previousFullyQualifiedClassname.matches("\\w[\\.\\w]+\\.class")) {
for (int i = 1; i < fieldDefinitions.length; i++) {
ResourceReference resourceReference = new ResourceReference(previousFullyQualifiedClassname.substring(0,
previousFullyQualifiedClassname.indexOf(".class")),
ResourceType.JAVA);
resourceReference.addPartReference(fieldDefinitions[i].getStringValue("name"),
PartType.FIELD);
previousFullyQualifiedClassname = fieldDefinitions[i].getStringValue("type");
builder.addGenerator(resourceReference);
}
}
}
}
}
}
}
} catch (Exception e) {
logger.error("Unable to index comparator definition for " + javaType.getQualifiedName());
}
}
示例12: visitField
import org.kie.workbench.common.services.refactoring.ResourceReference; //导入方法依赖的package包/类
protected void visitField(ResourceReference reference, FieldDefinition fieldDefinition) {
if (!StringUtils.isEmpty(fieldDefinition.getBinding())) {
reference.addPartReference(fieldDefinition.getBinding(), PartType.FIELD);
}
}