Added missing toString method
This commit is contained in:
parent
de1bb75c56
commit
71ad29c9ce
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.informationsystem.types.impl.properties;
|
package org.gcube.informationsystem.types.impl.properties;
|
||||||
|
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||||
|
import org.gcube.informationsystem.utils.ElementMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -72,4 +74,21 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
||||||
|
|
||||||
return AccessType.PROPERTY;
|
return AccessType.PROPERTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
try {
|
||||||
|
ElementMapper.marshal(this, stringWriter);
|
||||||
|
return stringWriter.toString();
|
||||||
|
}catch(Exception e){
|
||||||
|
try {
|
||||||
|
ElementMapper.marshal(this.header, stringWriter);
|
||||||
|
return stringWriter.toString();
|
||||||
|
} catch(Exception e1){
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.informationsystem.types.impl.relations;
|
package org.gcube.informationsystem.types.impl.relations;
|
||||||
|
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
||||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
||||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||||
|
import org.gcube.informationsystem.utils.ElementMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -157,4 +159,19 @@ public class RelationTypeImpl<S extends EntityType, T extends EntityType>
|
||||||
return AccessType.RELATION;
|
return AccessType.RELATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
try {
|
||||||
|
ElementMapper.marshal(this, stringWriter);
|
||||||
|
return stringWriter.toString();
|
||||||
|
}catch(Exception e){
|
||||||
|
try {
|
||||||
|
ElementMapper.marshal(this.header, stringWriter);
|
||||||
|
return stringWriter.toString();
|
||||||
|
} catch(Exception e1){
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue