* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.aai.schemaif.json.definitions;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
import java.util.List;
import org.onap.aai.schemaif.SchemaProviderException;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
public class DataTypeDefinition {
private static final Gson gson = new GsonBuilder().create();
-
+
private String name;
private String description;
private List<JsonPropertySchema> properties;
-
+
public String getName() {
return name;
}
public void setProperties(List<JsonPropertySchema> properties) {
this.properties = properties;
}
-
+
public void validate() throws SchemaProviderException {
- if ( (getName() == null) || (getName().isEmpty()) ) {
+ if ((getName() == null) || (getName().isEmpty())) {
throw new SchemaProviderException("Type definition missing a name");
}
}
}
}
-
+
public String toJson() {
return gson.toJson(this);
}
-
+
public static DataTypeDefinition fromJson(String json) {
return gson.fromJson(json, DataTypeDefinition.class);
}
@Override
public String toString() {
- return "DataTypeDefinition [name=" + name + ", description=" + description + ", properties="
- + properties + "]";
+ return "DataTypeDefinition [name=" + name + ", description=" + description + ", properties=" + properties + "]";
}
@Override
return false;
return true;
}
-
-
+
}