// Copyright 2017 JanusGraph Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package org.janusgraph.graphdb.schema; import org.janusgraph.core.Cardinality; import org.janusgraph.core.Multiplicity; import org.janusgraph.core.PropertyKey; import org.apache.tinkerpop.gremlin.structure.Direction; /** * @author Matthias Broecheler (me@matthiasb.com) */ public class PropertyKeyDefinition extends RelationTypeDefinition { private final Class<?> dataType; public PropertyKeyDefinition(String name, long id, Cardinality cardinality, Class dataType) { this(name,id,Multiplicity.convert(cardinality),dataType); } public PropertyKeyDefinition(String name, long id, Multiplicity multiplicity, Class dataType) { super(name, id, multiplicity); this.dataType = dataType; } public PropertyKeyDefinition(PropertyKey key) { this(key.name(),key.longId(),key.cardinality(),key.dataType()); } public Class<?> getDataType() { return dataType; } @Override public boolean isUnidirected(Direction dir) { return dir==Direction.OUT; } }