private static SchemaRule newRule( Kind kind, long id, int labelId, ByteBuffer buffer ) { switch ( kind ) { case INDEX_RULE: return readIndexRule( id, false, labelId, buffer ); case CONSTRAINT_INDEX_RULE: return readIndexRule( id, true, labelId, buffer ); case UNIQUENESS_CONSTRAINT: return readUniquenessConstraintRule( id, labelId, buffer ); case NODE_PROPERTY_EXISTENCE_CONSTRAINT: return readNodePropertyExistenceConstraintRule( id, labelId, buffer ); case RELATIONSHIP_PROPERTY_EXISTENCE_CONSTRAINT: return readRelPropertyExistenceConstraintRule( id, labelId, buffer ); default: throw new IllegalArgumentException( kind.name() ); } }
private static SchemaRule newRule( Kind kind, long id, int labelId, ByteBuffer buffer ) { switch ( kind ) { case INDEX_RULE: return readIndexRule( id, false, labelId, buffer ); case CONSTRAINT_INDEX_RULE: return readIndexRule( id, true, labelId, buffer ); case UNIQUENESS_CONSTRAINT: return readUniquenessConstraintRule( id, labelId, buffer ); case NODE_PROPERTY_EXISTENCE_CONSTRAINT: return readNodePropertyExistenceConstraintRule( id, labelId, buffer ); case RELATIONSHIP_PROPERTY_EXISTENCE_CONSTRAINT: return readRelPropertyExistenceConstraintRule( id, labelId, buffer ); default: throw new IllegalArgumentException( kind.name() ); } }
static SchemaRule deserialize( long id, int labelId, byte kindByte, ByteBuffer buffer ) throws MalformedSchemaRuleException { Kind kind = Kind.forId( kindByte ); try { SchemaRule rule = newRule( kind, id, labelId, buffer ); if ( null == rule ) { throw new MalformedSchemaRuleException( null, "Deserialized null schema rule for id %d with kind %s", id, kind.name() ); } return rule; } catch ( Exception e ) { throw new MalformedSchemaRuleException( e, "Could not deserialize schema rule for id %d with kind %s", id, kind.name() ); } }
static SchemaRule deserialize( long id, int labelId, byte kindByte, ByteBuffer buffer ) throws MalformedSchemaRuleException { Kind kind = Kind.forId( kindByte ); try { SchemaRule rule = newRule( kind, id, labelId, buffer ); if ( null == rule ) { throw new MalformedSchemaRuleException( null, "Deserialized null schema rule for id %d with kind %s", id, kind.name() ); } return rule; } catch ( Exception e ) { throw new MalformedSchemaRuleException( e, "Could not deserialize schema rule for id %d with kind %s", id, kind.name() ); } }