Implementing Schema Management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/information-system-model@129846 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-07-04 12:08:59 +00:00
parent 805886bef0
commit 26ac73ac91
2 changed files with 19 additions and 11 deletions

View File

@ -121,13 +121,22 @@ public class Type{
* @return OType instance if found, otherwise null
*/
public static OType getTypeByClass(final Class<?> iClass) {
if (iClass == null)
if (iClass == null) {
return null;
OType type = TYPES_BY_CLASS.get(iClass);
}
return type;
}
OType type = TYPES_BY_CLASS.get(iClass);
if (type != null) {
return type;
}
if(Enum.class.isAssignableFrom(iClass)){
type = TYPES_BY_CLASS.get(Enum.class);
}
return type;
}
}

View File

@ -6,7 +6,7 @@ package org.gcube.informationsystem.types;
import java.lang.reflect.Field;
import org.gcube.informationsystem.model.annotations.Abstract;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.embedded.RelationProperty;
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
import org.junit.Test;
import org.slf4j.Logger;
@ -59,11 +59,10 @@ public class EntitySchemaDefinition {
}
@Test
public void test() {
Class<? extends Facet> facet = Facet.class;
createTypeDefinition(facet);
public void test() throws Exception {
Class<?> clz = RelationProperty.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
}
}