Package com.upokecenter.cbor
Class PODOptions
- java.lang.Object
-
- com.upokecenter.cbor.PODOptions
-
public class PODOptions extends java.lang.ObjectOptions for converting "plain old data" objects (better known as POCOs in .NET or POJOs in Java) to CBOR objects.
-
-
Field Summary
Fields Modifier and Type Field Description static PODOptionsDefaultThe default settings for "plain old data" options.
-
Constructor Summary
Constructors Constructor Description PODOptions()Initializes a new instance of thePODOptionsclass.PODOptions(boolean removeIsPrefix, boolean useCamelCase)Initializes a new instance of thePODOptionsclass.PODOptions(java.lang.String paramString)Initializes a new instance of thePODOptionsclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetUseCamelCase()Gets a value indicating whether property, field, and method names are converted to camel case before they are used as keys.java.lang.StringtoString()Gets the values of this options object's properties in text form.
-
-
-
Field Detail
-
Default
public static final PODOptions Default
The default settings for "plain old data" options.
-
-
Constructor Detail
-
PODOptions
public PODOptions()
Initializes a new instance of thePODOptionsclass.
-
PODOptions
public PODOptions(boolean removeIsPrefix, boolean useCamelCase)Initializes a new instance of thePODOptionsclass.- Parameters:
removeIsPrefix- The parameter is not used.useCamelCase- The value of the "UseCamelCase" property.
-
PODOptions
public PODOptions(java.lang.String paramString)
Initializes a new instance of thePODOptionsclass.- Parameters:
paramString- A string setting forth the options to use. This is a semicolon-separated list of options, each of which has a key and a value separated by an equal sign ("="). Whitespace and line separators are not allowed to appear between the semicolons or between the equal signs, nor may the string begin or end with whitespace. The string can be empty, but cannot be null. The following is an example of this parameter:usecamelcase = true. The key can be any one of the following where the letters can be any combination of basic upper-case and/or basic lower-case letters:usecamelcase. Other keys are ignored. (Keys are compared using a basic case-insensitive comparison, in which two strings are equal if they match after converting the basic upper-case letters A to Z (U+0041 to U+005A) in both strings to basic lower-case letters.) If two or more key/value pairs have equal keys (in a basic case-insensitive comparison), the value given for the last such key is used. The key just given can have a value of1,true,yes, oron(where the letters can be any combination of basic upper-case and/or basic lower-case letters), which means true, and any other value meaning false. For example,usecamelcase = Yesandusecamelcase = 1both set theUseCamelCaseproperty to true. In the future, this class may allow other keys to store other kinds of values, not just true or false.- Throws:
java.lang.NullPointerException- The parameterparamStringis null.
-
-
Method Detail
-
toString
public java.lang.String toString()
Gets the values of this options object's properties in text form.- Overrides:
toStringin classjava.lang.Object- Returns:
- A text string containing the values of this options object's properties. The format of the string is the same as the one described in the string constructor for this class.
-
getUseCamelCase
public final boolean getUseCamelCase()
Gets a value indicating whether property, field, and method names are converted to camel case before they are used as keys. This option changes the behavior of key name serialization as follows. If "useCamelCase" is
false:- In the .NET version, all key names are capitalized, meaning the first letter in the name is converted to a basic upper-case letter if it's a basic lower-case letter ("a" to "z"). (For example, "Name" and "IsName" both remain unchanged.)
- In the Java version, all field names are capitalized, and for each eligible method name, the word "get" or "set" is removed from the name if the name starts with that word, then the name is capitalized. (For example, "getName" and "setName" both become "Name", and "isName" becomes "IsName".)
If "useCamelCase" is
true:- In the .NET version, for each eligible property or field name, the word "Is" is removed from the name if the name starts with that word, then the name is converted to camel case, meaning the first letter in the name is converted to a basic lower-case letter if it's a basic upper-case letter ("A" to "Z"). (For example, "Name" and "IsName" both become "name".)
- In the Java version: For each eligible method name, the word "get", "set", or "is" is removed from the name if the name starts with that word, then the name is converted to camel case. (For example, "getName", "setName", and "isName" all become "name".) For each eligible field name, the word "is" is removed from the name if the name starts with that word, then the name is converted to camel case. (For example, "name" and "isName" both become "name".)
In the description above, a name "starts with" a word if that word begins the name and is followed by a character other than a basic digit or basic lower-case letter, that is, other than "a" to "z" or "0" to "9".
- Returns:
trueIf the names are converted to camel case; otherwise,false. This property istrueby default.
-
-