import org.opendaylight.mdsal.binding.model.api.MethodSignature;
import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
import org.opendaylight.mdsal.binding.model.util.ReferencedTypeImpl;
import org.opendaylight.yangtools.concepts.Immutable;
}
private static Type referencedType(final Class<?> type) {
- return new ReferencedTypeImpl(type.getPackage().getName(), type.getSimpleName());
- }
-
- static Type referencedType(final String type) {
- final int packageClassSeparator = type.lastIndexOf(DOT);
- return new ReferencedTypeImpl(type.substring(0, packageClassSeparator), type.substring(packageClassSeparator + 1));
+ return new ReferencedTypeImpl(JavaTypeName.create(type));
}
/**
return getTypeWithSchema(referencedType(type));
}
- public Entry<GeneratedType, WithStatus> getTypeWithSchema(final String type) {
- return getTypeWithSchema(referencedType(type));
- }
-
private Entry<GeneratedType, WithStatus> getTypeWithSchema(final Type referencedType) {
final WithStatus schema = runtimeTypes.findSchema(referencedType).orElseThrow(
() -> new NullPointerException("Failed to find schema for type " + referencedType));
return getEnumMapping(typeWithSchema);
}
- /**
- * See {@link #getEnumMapping(Class)}}
- */
- public BiMap<String, String> getEnumMapping(final String enumClass) {
- final Entry<GeneratedType, WithStatus> typeWithSchema = getTypeWithSchema(enumClass);
- return getEnumMapping(typeWithSchema);
- }
-
private static BiMap<String, String> getEnumMapping(final Entry<GeneratedType, WithStatus> typeWithSchema) {
final TypeDefinition<?> typeDef = (TypeDefinition<?>) typeWithSchema.getValue();
if (type instanceof ReferencedTypeImpl) {
return type;
}
- return new ReferencedTypeImpl(type.getPackageName(), type.getName());
+ return new ReferencedTypeImpl(type.getIdentifier());
}
private static Set<Type> collectAllContainerTypes(final GeneratedType type, final Set<Type> collection) {