blob: a6394efb674fd5447e853cc8b01202709075df61 [file] [log] [blame]
/**
* Copyright (c) 2013-2015 Angelo ZERR.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation
*/
package org.eclipse.json.schema;
/**
*
* @see http://json-schema.org/latest/json-schema-core.html#rfc.section.3.5
*
*/
public enum JSONSchemaType {
Array("array"), Boolean("boolean"), Integer("integer"), Number("number"), Null(
"null"), Object("object"), String("string");
public static final JSONSchemaType[] EMPTY_TYPES = new JSONSchemaType[0];
private final String name;
private JSONSchemaType(String name) {
this.name = name;
}
public String getName() {
return name;
}
public static JSONSchemaType getType(String type) {
if (type == null) {
return null;
}
JSONSchemaType t = null;
JSONSchemaType[] types = JSONSchemaType.values();
for (int i = 0; i < types.length; i++) {
t = types[i];
if (t.getName().equals(type)) {
return t;
}
}
return null;
}
}