Package aQute.libg.dtos
Class DTOsImpl
java.lang.Object
aQute.libg.dtos.DTOsImpl
- All Implemented Interfaces:
DTOs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
(package private) static class
Nested classes/interfaces inherited from interface aQute.libg.dtos.DTOs
DTOs.Difference, DTOs.Reason
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Field[]
(package private) static Pattern
private static final org.slf4j.Logger
private final DTOsImpl.Link
(package private) static Pattern
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn a partially read only Map object that maps directly to a DTO.(package private) int
<T> T
deepCopy
(T source) Deep copy(package private) <T> T
deepCopy
(T source, DTOsImpl.Link link) boolean
deepEquals
(Object a, Object b) Check if two DTOs fields are equal.Return a list of paths where the two objects differ.private boolean
diff
(List<DTOs.Difference> diffs, DTOsImpl.Link link, Object older, Object newer) boolean
Check if two dtos fields are equal.Escape a string to be used in a path.String[]
fromPathToSegments
(String path) Takes a path with escaped '.'and '\' and then turns it into an array of unescaped keys(package private) String[]
fromPathToSegments
(String path, int start, int n) fromSegmentsToPath
(String[] segments) Takes a path with unescaped keys and turns it into a string path where the \ and .Access a DTO with a path.Access a DTO with a path that consists of an array with segments.(package private) Field
(package private) Field[]
(package private) Field[]
int
Calculate a hash Code for the fields in this DTO.boolean
Return true if the give dto is complex (either Map, Collection, Array, or has public fields.boolean
An object with public non-static non-synthetic fields.<T> T
shallowCopy
(T source) Shallow copyConvert a DTO to a human readable string presentation.Unescapes a string to be used in a path.
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
EMPTY_FIELDS
-
cache
-
root
-
ESCAPE_P
-
UNESCAPE_P
-
-
Constructor Details
-
DTOsImpl
public DTOsImpl()
-
-
Method Details
-
asMap
Description copied from interface:DTOs
Return a partially read only Map object that maps directly to a DTO. I.e. changes are reflected in the DTO. If a field is a DTO, then this field will also become a Map. -
getFields
-
getFields
-
bsearch
-
getField
-
shallowCopy
public <T> T shallowCopy(T source) Shallow copy- Specified by:
shallowCopy
in interfaceDTOs
- Parameters:
source
- the source object- Returns:
- a shallow copy of object
-
deepCopy
public <T> T deepCopy(T source) Deep copy -
deepCopy
-
fromPathToSegments
Description copied from interface:DTOs
Takes a path with escaped '.'and '\' and then turns it into an array of unescaped keys- Specified by:
fromPathToSegments
in interfaceDTOs
- Parameters:
path
- the path with escaped \ and .- Returns:
- a path array with unescaped segments
-
fromPathToSegments
-
fromSegmentsToPath
Description copied from interface:DTOs
Takes a path with unescaped keys and turns it into a string path where the \ and . are escaped.- Specified by:
fromSegmentsToPath
in interfaceDTOs
- Parameters:
segments
- The unescaped segments of the path- Returns:
- a string path where the . and \ are escaped.
-
deepEquals
Description copied from interface:DTOs
Check if two DTOs fields are equal. This is deep equal, that is the fields of this DTO are using this method is the object at a field is a DTO, recursively.- Specified by:
deepEquals
in interfaceDTOs
- Parameters:
a
- the first objectb
- the second object- Returns:
- true if both are null or the DTO's primary fields are equal
-
toString
Description copied from interface:DTOs
Convert a DTO to a human readable string presentation. This is primarily for debugging since the toString can truncate fields. This method must print all public fields, also non primary. Output formats can vary (e.g. YAML like) so the actual output should NOT be treated as standard. -
equals
Description copied from interface:DTOs
Check if two dtos fields are equal. This is shallow equal, that is the fields of this DTO are using the equals() instance method. -
hashCode
Description copied from interface:DTOs
Calculate a hash Code for the fields in this DTO. The dto must have at least one public field. -
get
Description copied from interface:DTOs
Access a DTO with a path. A path is a '.' separated string. Each part in the path is either a field name, key in a map, or an index in a list. If the path segments contain dots or backslashes, then these must be escaped -
get
Description copied from interface:DTOs
Access a DTO with a path that consists of an array with segments. Each segment in the path is either a field name, key in a map, or an index in a list. -
get
-
diff
Description copied from interface:DTOs
Return a list of paths where the two objects differ. The objects must be of the same class. -
diff
-
escape
Description copied from interface:DTOs
Escape a string to be used in a path. This will put a backslash ('\') in front of full stops ('.') and the backslash ('\'). -
unescape
Description copied from interface:DTOs
Unescapes a string to be used in a path. This will remove a backslash ('\') in front of full stops ('.') and the backslash ('\'). -
isComplex
Description copied from interface:DTOs
Return true if the give dto is complex (either Map, Collection, Array, or has public fields. -
isDTO
Description copied from interface:DTOs
An object with public non-static non-synthetic fields.
-