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 classNested classes/interfaces inherited from interface aQute.libg.dtos.DTOs
DTOs.Difference, DTOs.Reason -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Field[](package private) static Patternprivate static final org.slf4j.Loggerprivate 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> TdeepCopy(T source) Deep copy(package private) <T> TdeepCopy(T source, DTOsImpl.Link link) booleandeepEquals(Object a, Object b) Check if two DTOs fields are equal.Return a list of paths where the two objects differ.private booleandiff(List<DTOs.Difference> diffs, DTOsImpl.Link link, Object older, Object newer) booleanCheck 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[]intCalculate a hash Code for the fields in this DTO.booleanReturn true if the give dto is complex (either Map, Collection, Array, or has public fields.booleanAn object with public non-static non-synthetic fields.<T> TshallowCopy(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:DTOsReturn 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:
shallowCopyin 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:DTOsTakes a path with escaped '.'and '\' and then turns it into an array of unescaped keys- Specified by:
fromPathToSegmentsin interfaceDTOs- Parameters:
path- the path with escaped \ and .- Returns:
- a path array with unescaped segments
-
fromPathToSegments
-
fromSegmentsToPath
Description copied from interface:DTOsTakes a path with unescaped keys and turns it into a string path where the \ and . are escaped.- Specified by:
fromSegmentsToPathin interfaceDTOs- Parameters:
segments- The unescaped segments of the path- Returns:
- a string path where the . and \ are escaped.
-
deepEquals
Description copied from interface:DTOsCheck 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:
deepEqualsin 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:DTOsConvert 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:DTOsCheck 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:DTOsCalculate a hash Code for the fields in this DTO. The dto must have at least one public field. -
get
Description copied from interface:DTOsAccess 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:DTOsAccess 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:DTOsReturn a list of paths where the two objects differ. The objects must be of the same class. -
diff
-
escape
Description copied from interface:DTOsEscape 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:DTOsUnescapes 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:DTOsReturn true if the give dto is complex (either Map, Collection, Array, or has public fields. -
isDTO
Description copied from interface:DTOsAn object with public non-static non-synthetic fields.
-