public boolean isRamlScalarType() { Optional<ScalarType> st = ScalarType.fromType(realType); return st.isPresent(); }
private String calculateRamlType(Class<?> type) throws IOException { if (Class.class.equals(type)) { return "string"; } Optional<ScalarType> scalarType = ScalarType.fromType(type); if (scalarType.isPresent()) { return scalarType.get().getRamlSyntax(); } throw new IOException("invalid type for annotation: " + type); }
public boolean isRamlScalarType() { Optional<ScalarType> st = ScalarType.fromType(realType); return st.isPresent(); }
public String calculateRamlType(Class<?> type) throws IOException { if (Class.class.equals(type)) { return "string"; } Optional<ScalarType> scalarType = ScalarType.fromType(type); if (scalarType.isPresent()) { return scalarType.get().getRamlSyntax(); } throw new IOException("invalid type for annotation: " + type); }
public static RamlType fromType(Type type) { Optional<ScalarType> scalarTypeOptional = ScalarType.fromType(type); if (scalarTypeOptional.isPresent()) { return scalarTypeOptional.get(); } throw new RuntimeException(format("unknown type: %s", type)); }
public String getTypeName() { Optional<ScalarType> st = ScalarType.fromType(type.getType()); if (st.isPresent()) { if (collection == true) { return st.get().getRamlSyntax() + "[]"; } else { return st.get().getRamlSyntax(); } } else { Class c = (Class) type.getType(); if (collection == true) { return c.getSimpleName() + "[]"; } else { return c.getSimpleName(); } } }
public static RamlType fromType(Type type) { Optional<ScalarType> scalarTypeOptional = ScalarType.fromType(type); if (scalarTypeOptional.isPresent()) { return scalarTypeOptional.get(); } throw new RuntimeException(format("unknown type: %s", type)); }
public boolean isRamlScalarType() { Optional<ScalarType> st = ScalarType.fromType(type.getType()); return st.isPresent(); }
public static RamlType getRamlType(TypeRegistry typeRegistry, TypeScanner scanner, String simpleName, RamlEntity genericType) { RamlType fieldRamlType; if (ScalarType.fromType(genericType.getType()).isPresent()) { // scalars return new RamlType(genericType); } if (genericType.getType() instanceof ParameterizedType) { ParameterizedType ptype = (ParameterizedType) genericType.getType(); if (Collection.class.isAssignableFrom((Class<?>) ptype.getRawType())) { RamlEntity collectionEntityType = genericType.createDependent(ptype.getActualTypeArguments()[0]); RamlType collectionType = getRamlType(typeRegistry, scanner, ((Class) ptype.getActualTypeArguments()[0]).getSimpleName(), collectionEntityType ); return RamlType.collectionOf(collectionType); } } fieldRamlType = typeRegistry.registerType(simpleName, genericType, scanner); return fieldRamlType; } }
Optional<ScalarType> ramlType = ScalarType.fromType(parameter.getEntity().getType()); if (ramlType.isPresent()) { if (ramlType.get() == ScalarType.INTEGER || ramlType.get() == ScalarType.NUMBER) {
Optional<ScalarType> ramlType = ScalarType.fromType(parameter.getEntity().getType()); if (ramlType.isPresent()) { if (ramlType.get() == ScalarType.INTEGER || ramlType.get() == ScalarType.NUMBER) {