|
Brooklyn | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbrooklyn.util.flags.FlagUtils
public class FlagUtils
class to help transfer values passed as named arguments to other well-known variables/fields/objects; see the test case for example usage
Field Summary | |
---|---|
static Logger |
log
|
Method Summary | |
---|---|
static void
|
checkRequiredFields(java.lang.Object o)
@throws an IllegalStateException if there are fields required (nullable=false) which are unset |
static java.util.List
|
getAllAssignableTypes(java.lang.Class base)
returns base, superclasses, then interfaces |
static java.util.List
|
getAllAssignableTypes(java.lang.Class base, groovy.lang.Closure filter)
|
static java.util.List
|
getAllAssignableTypes(java.lang.Class base, Predicate filter)
|
static java.util.List
|
getAllFields(java.lang.Class base, groovy.lang.Closure filter)
returns all fields on the given class, superclasses, and interfaces thereof, in that order of preference, (excluding fields on Object) |
static java.util.List
|
getAllFields(java.lang.Class base)
|
static java.util.List
|
getAllFields(java.lang.Class base, Predicate filter)
|
static java.util.Map
|
getAnnotatedFields(java.lang.Class type)
returns a map of all fields which are annotated 'SetFromFlag', along with the annotation |
static java.lang.Object
|
getDefaultValueForType(java.lang.Class t)
returns the default/inital value that is assigned to fields of the givien type; if the type is not primitive this value is null; for primitive types it is obvious but not AFAIK programmatically visible (e.g. 0 for int, false for boolean) |
static java.lang.Object
|
getField(java.lang.Object objectOfField, java.lang.reflect.Field f)
gets the value of the field. |
static java.util.Map
|
getFieldsWithValues(java.lang.Object o)
returns a map of all fields which are annotated 'SetFromFlag' with their current values; useful if you want to clone settings from one object |
static java.util.List
|
getLocalFields(java.util.List classes)
returns all fields explicitly declared on the given classes |
static java.util.List
|
getLocalFields(java.util.List classes, groovy.lang.Closure filter)
|
static java.util.List
|
getLocalFields(java.util.List classes, Predicate filter)
|
static java.util.Map
|
setConfigKeysFromFlags(java.util.Map flags, AbstractEntity entity)
|
static void
|
setField(java.lang.Object objectOfField, java.lang.reflect.Field f, java.lang.Object value, SetFromFlag annotation)
sets the field to the value, after checking whether the given value can be set respecting the constraints of the annotation |
static java.util.Map
|
setFieldsFromFlags(java.util.Map flags, java.lang.Object o)
sets all fields (including private and static) on the given object and all supertypes, from the given flags map, returning just those flag-value pairs passed in which do not correspond to SetFromFlags fields |
static java.util.Map
|
setPublicFieldsFromFlags(java.util.Map flags, java.lang.Object o)
sets all public fields (local and inherited) on the given object from the given flags map, returning unknown elements |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final Logger log
Method Detail |
---|
public static void checkRequiredFields(java.lang.Object o)
public static java.util.List getAllAssignableTypes(java.lang.Class base)
public static java.util.List getAllAssignableTypes(java.lang.Class base, groovy.lang.Closure filter)
public static java.util.List getAllAssignableTypes(java.lang.Class base, Predicate filter)
public static java.util.List getAllFields(java.lang.Class base, groovy.lang.Closure filter)
public static java.util.List getAllFields(java.lang.Class base)
public static java.util.List getAllFields(java.lang.Class base, Predicate filter)
public static java.util.Map getAnnotatedFields(java.lang.Class type)
public static java.lang.Object getDefaultValueForType(java.lang.Class t)
public static java.lang.Object getField(java.lang.Object objectOfField, java.lang.reflect.Field f)
public static java.util.Map getFieldsWithValues(java.lang.Object o)
public static java.util.List getLocalFields(java.util.List classes)
public static java.util.List getLocalFields(java.util.List classes, groovy.lang.Closure filter)
public static java.util.List getLocalFields(java.util.List classes, Predicate filter)
public static java.util.Map setConfigKeysFromFlags(java.util.Map flags, AbstractEntity entity)
public static void setField(java.lang.Object objectOfField, java.lang.reflect.Field f, java.lang.Object value, SetFromFlag annotation)
public static java.util.Map setFieldsFromFlags(java.util.Map flags, java.lang.Object o)
public static java.util.Map setPublicFieldsFromFlags(java.util.Map flags, java.lang.Object o)
Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.