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

edu.uiuc.ncsa.security.storage.data.SerializationKeys Maven / Gradle / Ivy

package edu.uiuc.ncsa.security.storage.data;

import java.util.LinkedList;
import java.util.List;

/**
 * A class containing keys for data serialization, e.g. by databases or to XML.
 * 

Note that you might have to override the {@link #identifier} method if you want to specify * a key for the identifier different than the default. It is suggested you do this by * overriding the default constructor and setting the value there

*

And another thing

* The setters and getters are done using variable arguments. Invoking {@link #identifier} with * no arguments returns the current value. Passing any arguments sets its value to the first. * All extensions to this class should follow this pattern since it is very concise and simple to use. * Generally setting a value is only done by classes that override this. Having the usual accessor pattern * for these (get/set) leaves the impression that there is some state that apps can manipulate. In point of fact * these values are used in places such as database tables for column names which are immutable. *

Created by Jeff Gaynor
* on 4/13/12 at 3:03 PM */ public class SerializationKeys { String identifier = "identifier"; /** * Identifier for an {@link edu.uiuc.ncsa.security.core.Identifiable} object. This is used as the * primary identifier (primary key for SQL databases) for stored objects. Override at creation time * if you have a different primary key. Every Store implementation will automatically use this * for storing and retrieving objects. * @param x * @return */ public String identifier(String... x) { if (0 < x.length) identifier = x[0]; return identifier; } public List allKeys(){ LinkedList allKeys = new LinkedList<>(); allKeys.add(identifier()); return allKeys; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy