本文整理了Java中org.oasisopen.sca.annotation.Reference.required
方法的一些代码示例,展示了Reference.required
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.required
方法的具体详情如下:
包路径:org.oasisopen.sca.annotation.Reference
类名称:Reference
方法名:required
暂无
代码示例来源:origin: com.carecon.fabric3/fabric3-introspection-java
public void visitField(Reference annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) {
String name = annotation.name();
boolean required = annotation.required();
referenceProcessor.addDefinition(field, name, required, implClass, componentType, context);
}
代码示例来源:origin: com.carecon.fabric3/fabric3-introspection-java
public void visitConstructorParameter(Reference annotation,
Constructor<?> constructor,
int index,
Class<?> implClass,
InjectingComponentType componentType,
IntrospectionContext context) {
String name = annotation.name();
boolean required = annotation.required();
referenceProcessor.addDefinition(constructor, name, index, required, implClass, componentType, context);
}
代码示例来源:origin: com.carecon.fabric3/fabric3-introspection-java
public void visitMethod(Reference annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) {
String name = annotation.name();
boolean required = annotation.required();
referenceProcessor.addDefinition(method, name, required, implClass, componentType, context);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-introspection-java
public void visitField(Reference annotation,
Field field,
Class<?> implClass,
InjectingComponentType componentType,
IntrospectionContext context) {
String name = helper.getSiteName(field, annotation.name());
Type type = field.getGenericType();
FieldInjectionSite site = new FieldInjectionSite(field);
Annotation[] annotations = field.getAnnotations();
boolean required = annotation.required();
ReferenceDefinition definition = createDefinition(name, required, type, implClass, annotations, componentType, context);
componentType.add(definition, site);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-introspection-java
public void visitMethod(Reference annotation,
Method method,
Class<?> implClass,
InjectingComponentType componentType,
IntrospectionContext context) {
String name = helper.getSiteName(method, annotation.name());
Type type = helper.getGenericType(method);
MethodInjectionSite site = new MethodInjectionSite(method, 0);
Annotation[] annotations = method.getAnnotations();
ReferenceDefinition definition = createDefinition(name, annotation.required(), type, implClass, annotations, componentType, context);
componentType.add(definition, site);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-introspection-java
public void visitConstructorParameter(Reference annotation,
Constructor<?> constructor,
int index,
Class<?> implClass,
InjectingComponentType componentType,
IntrospectionContext context) {
String name = helper.getSiteName(constructor, index, annotation.name());
Type type = helper.getGenericType(constructor, index);
ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index);
Annotation[] annotations = constructor.getParameterAnnotations()[index];
boolean required = annotation.required();
ReferenceDefinition definition = createDefinition(name, required, type, implClass, annotations, componentType, context);
componentType.add(definition, site);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
@Override
public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
throws IntrospectionException {
Reference refAnnotation = parameter.getAnnotation(Reference.class);
if (refAnnotation == null) {
return;
}
if (!refAnnotation.required()) {
throw new InvalidReferenceException("[JCA90016] Constructor has @Reference with required=false: " + type.getName());
}
if (refAnnotation.name() == null || refAnnotation.name().length() < 1) {
throw new InvalidReferenceException("[JCA90018] @Reference in a Constructor must have a name attribute" + type.getName());
}
String paramName = parameter.getName();
String name = getReferenceName(paramName, parameter.getIndex(), refAnnotation.name());
JavaElementImpl ref = type.getReferenceMembers().get(name);
// Setter override field
if (ref != null && ref.getElementType() != ElementType.FIELD) {
throw new DuplicateReferenceException(name);
}
removeReference(ref, type);
org.apache.tuscany.sca.assembly.Reference reference = createReference(type, parameter, name);
type.getReferences().add(reference);
type.getReferenceMembers().put(name, parameter);
parameter.setClassifer(Reference.class);
parameter.setName(name);
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime
Reference ref = element.getAnnotation(Reference.class);
if (ref != null) {
required = ref.required();
内容来源于网络,如有侵权,请联系作者删除!