Search in sources :

Example 1 with ParameterizedType

use of org.opendaylight.mdsal.binding.model.api.ParameterizedType in project controller by opendaylight.

the class TemplateFactory method serializeType.

// FIXME: put into Type.toString
static String serializeType(final Type type, final boolean addWildcards) {
    if (type instanceof ParameterizedType) {
        final ParameterizedType parameterizedType = (ParameterizedType) type;
        final StringBuilder sb = new StringBuilder();
        sb.append(parameterizedType.getRawType().getFullyQualifiedName());
        sb.append(addWildcards ? "<? extends " : "<");
        boolean first = true;
        for (final Type parameter : parameterizedType.getActualTypeArguments()) {
            if (first) {
                first = false;
            } else {
                sb.append(",");
            }
            sb.append(serializeType(parameter));
        }
        sb.append(">");
        return sb.toString();
    } else {
        return type.getFullyQualifiedName();
    }
}
Also used : ParameterizedType(org.opendaylight.mdsal.binding.model.api.ParameterizedType) SimpleType(javax.management.openmbean.SimpleType) ParameterizedType(org.opendaylight.mdsal.binding.model.api.ParameterizedType) Type(org.opendaylight.mdsal.binding.model.api.Type)

Aggregations

SimpleType (javax.management.openmbean.SimpleType)1 ParameterizedType (org.opendaylight.mdsal.binding.model.api.ParameterizedType)1 Type (org.opendaylight.mdsal.binding.model.api.Type)1