Java Code Examples for org.apache.cxf.service.model.MessagePartInfo#getIndex()

The following examples show how to use org.apache.cxf.service.model.MessagePartInfo#getIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RequestWrapper.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
    List<JavaField> fields = new ArrayList<>();

    final Type[] paramClasses = method.getGenericParameterTypes();
    final Annotation[][] paramAnnotations = method.getParameterAnnotations();

    for (MessagePartInfo mpi : message.getMessageParts()) {
        int idx = mpi.getIndex();
        String name = mpi.getName().getLocalPart();
        Type t = paramClasses[idx];
        String type = getTypeString(t);

        JavaField field = new JavaField(name, type, "");

        if (paramAnnotations != null
            && paramAnnotations.length == paramClasses.length) {
            WebParam wParam = getWebParamAnnotation(paramAnnotations[idx]);
            if (wParam != null && !StringUtils.isEmpty(wParam.targetNamespace())) {
                field.setTargetNamespace(wParam.targetNamespace());
            } else {
                field.setTargetNamespace("");
            }
        }

        List<Annotation> jaxbAnns = WrapperUtil.getJaxbAnnotations(method, idx);
        field.setJaxbAnnotations(jaxbAnns.toArray(new Annotation[0]));
        fields.add(field);
    }

    return fields;
}
 
Example 2
Source File: WrapperClassGenerator.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Annotation[] getMethodParameterAnnotations(final MessagePartInfo mpi) {
    Annotation[] a = (Annotation[])mpi.getProperty(ReflectionServiceFactoryBean.PARAM_ANNOTATION);
    if (a != null) {
        return a;
    }

    Annotation[][] paramAnno = (Annotation[][])mpi
        .getProperty(ReflectionServiceFactoryBean.METHOD_PARAM_ANNOTATIONS);
    int index = mpi.getIndex();
    if (paramAnno != null && index < paramAnno.length && index >= 0) {
        return paramAnno[index];
    }
    return null;
}
 
Example 3
Source File: ReflectionServiceFactoryBean.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Annotation[] getMethodParameterAnnotations(final MessagePartInfo mpi) {
    Annotation[][] paramAnno = (Annotation[][])mpi.getProperty(METHOD_PARAM_ANNOTATIONS);
    int index = mpi.getIndex();
    if (paramAnno != null && index < paramAnno.length && index >= 0) {
        return paramAnno[index];
    }
    return null;
}
 
Example 4
Source File: MessageContentsList.java    From cxf with Apache License 2.0 4 votes vote down vote up
public Object put(MessagePartInfo key, Object value) {
    ensureSize(key.getIndex());
    return super.set(key.getIndex(), value);
}
 
Example 5
Source File: MessageContentsList.java    From cxf with Apache License 2.0 4 votes vote down vote up
public boolean hasValue(MessagePartInfo key) {
    if (key.getIndex() >= size()) {
        return false;
    }
    return super.get(key.getIndex()) != REMOVED_MARKER;
}
 
Example 6
Source File: MessageContentsList.java    From cxf with Apache License 2.0 4 votes vote down vote up
public Object get(MessagePartInfo key) {
    Object o = super.get(key.getIndex());
    return o == REMOVED_MARKER ? null : o;
}