org.neo4j.kernel.api.properties.Property Maven / Gradle / Ivy
/*
* Copyright (c) 2002-2015 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.neo4j.kernel.api.properties;
import java.util.concurrent.Callable;
import org.neo4j.kernel.api.EntityType;
import org.neo4j.kernel.api.exceptions.PropertyNotFoundException;
public abstract class Property
{
public static Property noNodeProperty( long nodeId, int propertyKeyId )
{
return noProperty( propertyKeyId, EntityType.NODE, nodeId );
}
public static Property noRelationshipProperty( long relationshipId, int propertyKeyId )
{
return noProperty( propertyKeyId, EntityType.RELATIONSHIP, relationshipId );
}
public static Property noGraphProperty( int propertyKeyId )
{
return noProperty( propertyKeyId, EntityType.GRAPH, -1 );
}
private static Property noProperty( int propertyKeyId, EntityType type, long entityId )
{
return new NoProperty( propertyKeyId, type, entityId );
}
public static DefinedProperty property( int propertyKeyId, Object value )
{
return PropertyConversion.convertProperty( propertyKeyId, value );
}
final int propertyKeyId;
Property( int propertyKeyId )
{
this.propertyKeyId = propertyKeyId;
}
public final int propertyKeyId()
{
return propertyKeyId;
}
public abstract boolean valueEquals( Object other );
public abstract Object value() throws PropertyNotFoundException;
public abstract Object value( Object defaultValue );
public abstract String valueAsString() throws PropertyNotFoundException;
@Override
public abstract boolean equals( Object obj );
@Override
public abstract int hashCode();
public abstract boolean isDefined();
// direct factory methods
public static DefinedProperty stringProperty( int propertyKeyId, String value )
{
return new StringProperty( propertyKeyId, value );
}
public static DefinedProperty lazyStringProperty( int propertyKeyId, Callable producer )
{
return new LazyStringProperty( propertyKeyId, producer );
}
public static DefinedProperty lazyArrayProperty( int propertyKeyId, Callable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy