Java Code Examples for com.orientechnologies.orient.core.metadata.schema.OClass#getCustom()

The following examples show how to use com.orientechnologies.orient.core.metadata.schema.OClass#getCustom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomAttribute.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public <V> V getValue(OClass oClass, V defaultValue, boolean hiearchical)
{
	String stringValue = oClass.getCustom(name);
	if(encode) stringValue = decodeCustomValue(stringValue);
	V ret;
	if(OProperty.class.isAssignableFrom(javaClass))
	{
		ret = (V)resolveProperty(oClass, stringValue);
	}
	else
	{
		ret = (V) OType.convert(stringValue, javaClass);
	}
	if(ret==null && hiearchical) {
		for(OClass superClass : oClass.getSuperClasses()) {
			if((ret=getValue(superClass, null, true))!=null) break;
		}
	}
	return ret!=null?ret:defaultValue;
}
 
Example 2
Source File: OClassCustomModel.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
@Override
protected String getValue(OClass object, String param) {
	return object.getCustom(param);
}