public class ConfigPath
extends java.lang.Object
One edge case is possible (but assumed to never happen): when property declared as Object in class, actual type could be resolved from value. But that means that if value become null, property binding type would change to Object. Assume no one would ever use Object for configuration property (or, if so, value will never be null because otherwise there will be no binding available in both cases).
Item contains root and child references and might be traversed like a tree.
| Constructor and Description |
|---|
ConfigPath(ConfigPath root,
java.lang.Class declarationClass,
java.lang.Class declaredType,
java.lang.Class valueType,
java.util.List<java.lang.reflect.Type> declaredTypeGenerics,
java.util.List<java.lang.reflect.Type> valueTypeGenerics,
java.lang.String path,
java.lang.Object value,
boolean customType,
boolean objectDeclaration) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.util.List<ConfigPath> |
getChildren()
For example, if current path is "sub" then returned items would be next level paths: "sub.val1", "sub.val2" etc.
|
java.lang.Class |
getDeclarationClass()
Note that this would be last path's part (property) declaration class.
|
java.lang.Class |
getDeclaredType()
If property is declared as collection implementation then collection interface will be used instead.
|
java.util.List<java.lang.Class> |
getDeclaredTypeGenericClasses()
Useful for quick analysis when deeper generic type knowledge is not important (e.g. to know type in
list, set or map).
|
java.util.List<java.lang.reflect.Type> |
getDeclaredTypeGenerics()
For example, if value is List then one parameter will be available with list generic type.
|
java.lang.reflect.Type |
getDeclaredTypeWithGenerics() |
java.lang.String |
getLastPathLevel() |
java.lang.String |
getPath()
E.g.
|
ConfigPath |
getRoot()
For example, if current path is "some.long.path" then method returns "some.long" path item.
|
java.lang.Class |
getRootDeclarationClass()
Useful to filter out core dropwizard properties (where root type would be
Configuration. |
java.lang.reflect.Type |
getTypeWithGenerics()
When value null will be the same as
getDeclaredTypeWithGenerics(). |
java.lang.Object |
getValue() |
java.lang.Class |
getValueType()
When value is null, type may be still different from
getDeclaredType() if declared
type was actually some collection implementation. |
java.util.List<java.lang.Class> |
getValueTypeGenericClasses()
Useful for quick analysis when deeper generic type knowledge is not important..
|
java.util.List<java.lang.reflect.Type> |
getValueTypeGenerics()
Even when value is null, generics could differ from declared type generics.
|
int |
hashCode() |
boolean |
isCustomType()
Type considered custom when it's not primitive, collection and few other simple types.
|
boolean |
isObjectDeclaration()
True means that property declared as Object.
|
java.lang.String |
toString() |
java.lang.String |
toStringDeclaredType() |
java.lang.String |
toStringType() |
java.lang.String |
toStringValue()
Only put string values other than null into quotes (to be more obvious).
|
public ConfigPath(ConfigPath root, java.lang.Class declarationClass, java.lang.Class declaredType, java.lang.Class valueType, java.util.List<java.lang.reflect.Type> declaredTypeGenerics, java.util.List<java.lang.reflect.Type> valueTypeGenerics, java.lang.String path, java.lang.Object value, boolean customType, boolean objectDeclaration)
public ConfigPath getRoot()
public java.util.List<ConfigPath> getChildren()
public java.lang.Class getDeclarationClass()
public java.lang.Class getDeclaredType()
ArrayList<String> then declaration type would be List<String>.
Edge case possible: if class declaration is Object and value is not null then actual value would be taken from value. This case should never appear, because it's insane to use Object to declare property type.
public java.lang.Class getValueType()
getDeclaredType() if declared
type was actually some collection implementation.public java.util.List<java.lang.reflect.Type> getDeclaredTypeGenerics()
When actual generics are not set then upper bounds of declared generics will be used. For example,
for List it will be [Object] and for class Some<T extends Comparable> -
[Comparable].
getDeclaredTypeGenericClasses()public java.util.List<java.lang.reflect.Type> getValueTypeGenerics()
ExtraList<String, Integer>, declaration type List<String> (so it's generics just [List]).
And type generics would be [String, Integer].public java.lang.String getPath()
public java.lang.Object getValue()
public boolean isCustomType()
public boolean isObjectDeclaration()
Indicator might be important because in this case binding would be of Object type when value is null and with value type for not null value.
public java.util.List<java.lang.Class> getDeclaredTypeGenericClasses()
getDeclaredTypeGenerics()public java.util.List<java.lang.Class> getValueTypeGenericClasses()
public java.lang.Class getRootDeclarationClass()
Configuration.public java.lang.reflect.Type getDeclaredTypeWithGenerics()
public java.lang.reflect.Type getTypeWithGenerics()
getDeclaredTypeWithGenerics(). If types are different
(value not null), then actual type generics will be tracked from known definition generics.public java.lang.String getLastPathLevel()
public java.lang.String toStringDeclaredType()
public java.lang.String toStringType()
public java.lang.String toStringValue()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object