All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.driver.mapping.NamingConvention Maven / Gradle / Ivy

There is a newer version: 3.11.5
Show newest version
/*
 *      Copyright (C) 2012-2015 DataStax Inc.
 *
 *   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 com.datastax.driver.mapping;

import java.util.List;

/**
 * Represent a naming convention (e.g. snake_case, camelCase, etc...) to be used when
 * auto-translating java property names to cassandra column names and vice versa.
 * 

* This interface may be implemented to define custom naming convention. */ public interface NamingConvention { /** * Receive a property name value and returns an ordered list of Word objects. * Each word contains a String value and a boolean indicating whether or not * the value is an abbreviation (In most cases could not be determined). * Quick examples: *

    *
  • Let's consider lowerCamelCase convention and input = "myXMLParser", * then the output should be: * [ * word{value = "my", isAbbreviation = false}, * word{value = "xml", isAbbreviation = true}, * word{value = "parser", isAbbreviation = false} * ]
  • *
  • Let's consider lower_snake_case convention and input = "myXMLParser", * then the output may be (since there's no trivial way to determine xml * to an abbreviation): * [ * word{value = "my", isAbbreviation = false}, * word{value = "xml", isAbbreviation = false}, * word{value = "parser", isAbbreviation = false} * ]
  • *
* * @param input value to split * @return an ordered list of split Word objects */ List split(String input); /** * Receive an ordered list of Word objects and returns a result property name. * Quick examples: *
    *
  • Let's consider lowerCamelCase convention with upperCaseAbbreviations set * to false, and input = [ * word{value = "my", isAbbreviation = false}, * word{value = "xml", isAbbreviation = true}, * word{value = "parser", isAbbreviation = false} * ] * then the output should be "myXmlParser".
  • *
  • Let's consider upperCamelCase convention with upperCaseAbbreviations set * to true, and input = [ * word{value = "my", isAbbreviation = false}, * word{value = "xml", isAbbreviation = true}, * word{value = "parser", isAbbreviation = false} * ] * then the output should be "MyXMLParser".
  • *
* * @param input list to translate * @return the result property name */ String join(List input); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy