Package org.openjdk.jmc.common.item
Class PersistableItemFilter
- java.lang.Object
-
- org.openjdk.jmc.common.item.PersistableItemFilter
-
- All Implemented Interfaces:
IStateful
,IItemFilter
- Direct Known Subclasses:
ItemFilters.AttributeFilter
,ItemFilters.Composite
,ItemFilters.Not
,ItemFilters.Type
,ItemFilters.TypeMatches
public abstract class PersistableItemFilter extends java.lang.Object implements IItemFilter, IStateful
Simple provisional persistence implementation for item filter. It has a few issues of various importance:- Like the current filter variants, it is non-canonical: MEMBER_OF can be rewritten as an OR of EQUALs, and similarly with the TYPE variants. INTERVAL can be expressed as an AND of LESS and MORE. (Apart from the API omission that closedness cannot by expressed in the latter two.)
- The current XML structure isn't as simple as it could be, and not easily verifiable by a simple schema.
- Delegation responsibilities to sub-filters and content types for persisting and parsing aren't very clear.
- Behavior with unpersistable sub-filters and content types is somewhat unspecified.
- Content types for values use the internal legacy ad-hoc identifiers. It would be better to use well specified (standardized) expressions where possible (units/kind-of-quantities, Java classes, as in "JMX 2.0").
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PersistableItemFilter.Kind
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
KEY_END
(package private) static java.lang.String
KEY_FIELD
(package private) static java.lang.String
KEY_FILTER
private static java.lang.String
KEY_KIND
(package private) static java.lang.String
KEY_START
(package private) static java.lang.String
KEY_TYPE
(package private) static java.lang.String
KEY_TYPE_MATCHES
(package private) static java.lang.String
KEY_VALUE
protected PersistableItemFilter.Kind
kind
-
Constructor Summary
Constructors Modifier Constructor Description protected
PersistableItemFilter(PersistableItemFilter.Kind kind)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static <M> ICanonicalAccessorFactory<M>
createAttribute(java.lang.String id, ContentType<M> type)
protected static void
putValueType(IWritableState memento, ContentType<?> contentType)
private static ICanonicalAccessorFactory<?>
readAttribute(IState memento)
private static <M extends java.lang.Comparable<? super M>>
ICanonicalAccessorFactory<M>readComparableAttribute(IState memento)
private static <M extends java.lang.Comparable<? super M>>
IItemFilterreadComparableKindFrom(ICanonicalAccessorFactory<M> attribute, PersistableItemFilter.Kind kind, IState memento)
private static <M extends java.lang.Comparable<? super M>>
IItemFilterreadComparableKindFrom(PersistableItemFilter.Kind kind, IState memento)
private static <M extends java.lang.Comparable<? super M>>
ContentType<M>readComparableType(IState memento)
private static <M> IItemFilter
readEquals(ICanonicalAccessorFactory<M> attribute, IState memento)
static IItemFilter
readFrom(IState memento)
private static IItemFilter[]
readFrom(IState[] mementos)
private static <M> IItemFilter
readNotEquals(ICanonicalAccessorFactory<M> attribute, IState memento)
private static <M extends java.lang.Comparable<? super M>>
IItemFilterreadRangeMatchesFrom(PersistableItemFilter.Kind kind, IState memento)
private static ICanonicalAccessorFactory<java.lang.String>
readStringAttribute(IState memento)
(package private) static <M> M
readValue(IPersister<M> persister, IState from)
(package private) static <M> M
readValue(IPersister<M> persister, IState from, java.lang.String key)
protected abstract void
saveArgs(IWritableState memento)
void
saveTo(IWritableState memento)
Saves the state for this object into a state object.java.lang.String
toString()
java.lang.String
toString(java.lang.String argumentName, java.lang.Object value)
(package private) static <M> void
writeValue(M value, IPersister<M> persister, IWritableState to)
(package private) static <M> void
writeValue(M value, IPersister<M> persister, IWritableState to, java.lang.String key)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openjdk.jmc.common.item.IItemFilter
getPredicate
-
-
-
-
Field Detail
-
KEY_KIND
private static final java.lang.String KEY_KIND
- See Also:
- Constant Field Values
-
KEY_FILTER
static final java.lang.String KEY_FILTER
- See Also:
- Constant Field Values
-
KEY_FIELD
static final java.lang.String KEY_FIELD
- See Also:
- Constant Field Values
-
KEY_TYPE
static final java.lang.String KEY_TYPE
- See Also:
- Constant Field Values
-
KEY_TYPE_MATCHES
static final java.lang.String KEY_TYPE_MATCHES
- See Also:
- Constant Field Values
-
KEY_VALUE
static final java.lang.String KEY_VALUE
- See Also:
- Constant Field Values
-
KEY_START
static final java.lang.String KEY_START
- See Also:
- Constant Field Values
-
KEY_END
static final java.lang.String KEY_END
- See Also:
- Constant Field Values
-
kind
protected final PersistableItemFilter.Kind kind
-
-
Constructor Detail
-
PersistableItemFilter
protected PersistableItemFilter(PersistableItemFilter.Kind kind)
-
-
Method Detail
-
saveTo
public final void saveTo(IWritableState memento)
Description copied from interface:IStateful
Saves the state for this object into a state object.
-
saveArgs
protected abstract void saveArgs(IWritableState memento)
-
putValueType
protected static void putValueType(IWritableState memento, ContentType<?> contentType)
-
readFrom
public static IItemFilter readFrom(IState memento)
-
readEquals
private static <M> IItemFilter readEquals(ICanonicalAccessorFactory<M> attribute, IState memento)
-
readNotEquals
private static <M> IItemFilter readNotEquals(ICanonicalAccessorFactory<M> attribute, IState memento)
-
readComparableKindFrom
private static <M extends java.lang.Comparable<? super M>> IItemFilter readComparableKindFrom(PersistableItemFilter.Kind kind, IState memento)
-
readComparableKindFrom
private static <M extends java.lang.Comparable<? super M>> IItemFilter readComparableKindFrom(ICanonicalAccessorFactory<M> attribute, PersistableItemFilter.Kind kind, IState memento)
-
readRangeMatchesFrom
private static <M extends java.lang.Comparable<? super M>> IItemFilter readRangeMatchesFrom(PersistableItemFilter.Kind kind, IState memento)
-
readValue
static <M> M readValue(IPersister<M> persister, IState from)
-
readValue
static <M> M readValue(IPersister<M> persister, IState from, java.lang.String key)
-
writeValue
static <M> void writeValue(M value, IPersister<M> persister, IWritableState to)
-
writeValue
static <M> void writeValue(M value, IPersister<M> persister, IWritableState to, java.lang.String key)
-
readFrom
private static IItemFilter[] readFrom(IState[] mementos)
-
readStringAttribute
private static ICanonicalAccessorFactory<java.lang.String> readStringAttribute(IState memento)
-
readComparableType
private static <M extends java.lang.Comparable<? super M>> ContentType<M> readComparableType(IState memento)
-
readAttribute
private static ICanonicalAccessorFactory<?> readAttribute(IState memento)
-
readComparableAttribute
private static <M extends java.lang.Comparable<? super M>> ICanonicalAccessorFactory<M> readComparableAttribute(IState memento)
-
createAttribute
private static <M> ICanonicalAccessorFactory<M> createAttribute(java.lang.String id, ContentType<M> type)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String argumentName, java.lang.Object value)
-
-