/*
* Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nuxeo - initial API and implementation
*
* $Id$
*/
package org.eclipse.ecr.core.schema.types;
import org.eclipse.ecr.core.schema.SchemaNames;
import org.eclipse.ecr.core.schema.TypeRef;
/**
* @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
*
*/
public abstract class PrimitiveType extends AbstractType implements SimpleType {
private static final long serialVersionUID = -2698475002119528248L;
protected PrimitiveType(String name) {
super(null, SchemaNames.BUILTIN, name);
}
@Override
public abstract boolean validate(Object object);
@Override
public Type getSuperType() {
return null;
}
@Override
public Type[] getTypeHierarchy() {
return EMPTY_SUPERTYPES;
}
// FIXME: IType doesn't have an isPrimitive method.
@Override
public boolean isPrimitive() {
return true;
}
@Override
public boolean isSimpleType() {
return true;
}
@Override
public SimpleType getPrimitiveType() {
return this;
}
@Override
public TypeRef<PrimitiveType> getRef() {
return new TypeRef<PrimitiveType>(schema, name, this);
}
}