code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
public Collection<V> values() {
Collection<V> vs = values;
return (vs != null) ? vs : (values = new Values());
} | Returns a {@link Collection} view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. The collection
supports element removal, which removes the corresponding
mapping from this map, via the <tt>Iterator.remove</tt>,
<tt>Collec... | values | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Set<Map.Entry<K,V>> entrySet() {
Set<Map.Entry<K,V>> es = entrySet;
return (es != null) ? es : (entrySet = new EntrySet());
} | Returns a {@link Set} view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. The set supports element
removal, which removes the corresponding mapping from the map,
via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
<tt>removeAll</t... | entrySet | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Enumeration<K> keys() {
return new KeyIterator();
} | Returns an enumeration of the keys in this table.
@return an enumeration of the keys in this table
@see #keySet() | keys | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Enumeration<V> elements() {
return new ValueIterator();
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | elements | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
final void advance() {
if (nextEntry != null && (nextEntry = nextEntry.next) != null)
return;
while (nextTableIndex >= 0) {
if ( (nextEntry = currentTable[nextTableIndex--]) != null)
return;
}
while (nextSegmentIndex >... | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | advance | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean hasNext() {
while (nextEntry != null) {
if (nextEntry.key() != null)
return true;
advance();
}
return false;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | hasNext | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
HashEntry<K,V> nextEntry() {
do {
if (nextEntry == null)
throw new NoSuchElementException();
lastReturned = nextEntry;
currentKey = lastReturned.key();
advance();
} while (currentKey == null); // Skip GC'd keys
... | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | nextEntry | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public void remove() {
if (lastReturned == null)
throw new IllegalStateException();
ConcurrentReferenceHashMap.this.remove(currentKey);
lastReturned = null;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | remove | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public K getKey() {
return key;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | getKey | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public V getValue() {
return value;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | getValue | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public V setValue(V value) {
V oldValue = this.value;
this.value = value;
return oldValue;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | setValue | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
return false;
@SuppressWarnings("unchecked")
Map.Entry e = (Map.Entry) o;
return eq(key, e.getKey()) && eq(value, e.getValue());
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | equals | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public int hashCode() {
return (key == null ? 0 : key.hashCode())
^ (value == null ? 0 : value.hashCode());
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | hashCode | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public String toString() {
return key + "=" + value;
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | toString | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
private static boolean eq(Object o1, Object o2) {
return o1 == null ? o2 == null : o1.equals(o2);
} | Returns an enumeration of the values in this table.
@return an enumeration of the values in this table
@see #values() | eq | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public V setValue(V value) {
if (value == null) throw new NullPointerException();
V v = super.setValue(value);
ConcurrentReferenceHashMap.this.put(getKey(), value);
return v;
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | setValue | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Map.Entry<K,V> next() {
HashEntry<K,V> e = super.nextEntry();
return new WriteThroughEntry(e.key(), e.value());
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | next | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Iterator<K> iterator() {
return new KeyIterator();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | iterator | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public int size() {
return ConcurrentReferenceHashMap.this.size();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | size | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean isEmpty() {
return ConcurrentReferenceHashMap.this.isEmpty();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | isEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean contains(Object o) {
return ConcurrentReferenceHashMap.this.containsKey(o);
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | contains | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean remove(Object o) {
return ConcurrentReferenceHashMap.this.remove(o) != null;
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | remove | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Iterator<V> iterator() {
return new ValueIterator();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | iterator | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public int size() {
return ConcurrentReferenceHashMap.this.size();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | size | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean isEmpty() {
return ConcurrentReferenceHashMap.this.isEmpty();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | isEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean contains(Object o) {
return ConcurrentReferenceHashMap.this.containsValue(o);
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | contains | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public Iterator<Map.Entry<K,V>> iterator() {
return new EntryIterator();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | iterator | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean contains(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
V v = ConcurrentReferenceHashMap.this.get(e.getKey());
return v != null && v.equals(e.getValue());
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | contains | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean remove(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry<?,?> e = (Map.Entry<?,?>)o;
return ConcurrentReferenceHashMap.this.remove(e.getKey(), e.getValue());
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | remove | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public int size() {
return ConcurrentReferenceHashMap.this.size();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | size | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public boolean isEmpty() {
return ConcurrentReferenceHashMap.this.isEmpty();
} | Set our entry's value and write through to the map. The
value to return is somewhat arbitrary here. Since a
WriteThroughEntry does not necessarily track asynchronous
changes, the most recent "previous" value could be
different from what we return (or could even have been
removed in which case the put will re-establish)... | isEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException {
s.defaultReadObject();
// Initialize each segment to be minimally sized, and let grow.
for (int i = 0; i < segments.length; ++i) {
segmen... | Reconstitute the <tt>ConcurrentReferenceHashMap</tt> instance from a
stream (i.e., deserialize it).
@param s the stream | readObject | java | togglz/togglz | core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/ConcurrentReferenceHashMap.java | Apache-2.0 |
public static String getLabel(Feature feature) {
Label label = getAnnotation(feature, Label.class);
if (label != null) {
return label.value();
}
return feature.name();
} | Utility class to read annotation on feature enums.
@author Christian Kaltepoth
@author Eli Abramovitch | getLabel | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
public static boolean isEnabledByDefault(Feature feature) {
return isAnnotationPresent(feature, EnabledByDefault.class);
} | Utility class to read annotation on feature enums.
@author Christian Kaltepoth
@author Eli Abramovitch | isEnabledByDefault | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
public static boolean isAnnotationPresent(Feature feature, Class<? extends Annotation> annotationType) {
return getAnnotation(feature, annotationType) != null;
} | Utility class to read annotation on feature enums.
@author Christian Kaltepoth
@author Eli Abramovitch | isAnnotationPresent | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
public static Set<Annotation> getAnnotations(Feature feature) {
Set<Annotation> annotations = new HashSet<>();
try {
Class<? extends Feature> featureClass = feature.getClass();
Annotation[] fieldAnnotations = featureClass.getField(feature.name()).getAnnotations();
Ann... | Utility class to read annotation on feature enums.
@author Christian Kaltepoth
@author Eli Abramovitch | getAnnotations | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
public static <A extends Annotation> A getAnnotation(Feature feature, Class<A> annotationType) {
try {
Class<? extends Feature> featureClass = feature.getClass();
A fieldAnnotation = featureClass.getField(feature.name()).getAnnotation(annotationType);
A classAnnotation = feat... | Utility class to read annotation on feature enums.
@author Christian Kaltepoth
@author Eli Abramovitch | getAnnotation | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
public static String[] getFeatureAttribute(Annotation annotation) {
try {
// only annotations which are annotated with @FeatureAttribute are interesting
FeatureAttribute details = annotation.annotationType().getAnnotation(FeatureAttribute.class);
if (details != null) {
... | Checks whether the supplied annotation specifies a feature attribute. If so, it returns an String array containing the
name of the attribute at the first and the value at the second position. Returns <code>null</code> if no attribute was
found. | getFeatureAttribute | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureAnnotations.java | Apache-2.0 |
@Override
public Boolean get(Object key) {
Validate.notNull(key, "The feature must not be null");
Feature feature = null;
if (key instanceof Feature) {
feature = (Feature) key;
} else {
feature = new NamedFeature(key.toString());
}
return ma... | Constructor that allows to manually set the feature manager to use. | get | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public int size() {
return manager.getFeatures().size();
} | Constructor that allows to manually set the feature manager to use. | size | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public boolean isEmpty() {
return size() == 0;
} | Constructor that allows to manually set the feature manager to use. | isEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public boolean containsKey(Object key) {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | containsKey | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public boolean containsValue(Object value) {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | containsValue | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public Boolean put(Object key, Boolean value) {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | put | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public Boolean remove(Object key) {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | remove | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public void putAll(Map<? extends Object, ? extends Boolean> m) {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | putAll | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public void clear() {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | clear | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public Set<Object> keySet() {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | keySet | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public Collection<Boolean> values() {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | values | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
@Override
public Set<Map.Entry<Object, Boolean>> entrySet() {
throw new UnsupportedOperationException();
} | Constructor that allows to manually set the feature manager to use. | entrySet | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureMap.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureMap.java | Apache-2.0 |
public boolean isEnabled() {
return enabled;
} | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | isEnabled | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public void setEnabled(boolean enabled) {
this.enabled = enabled;
} | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | setEnabled | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public String getStrategyId() {
return strategyId;
} | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | getStrategyId | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public void setStrategyId(String strategyId) {
this.strategyId = strategyId;
} | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | setStrategyId | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public Map<String, String> getParameters() {
return parameters;
} | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | getParameters | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public static FeatureStateStorageWrapper wrapperForFeatureState(FeatureState featureState) {
FeatureStateStorageWrapper wrapper = new FeatureStateStorageWrapper();
wrapper.setEnabled(featureState.isEnabled());
wrapper.setStrategyId(featureState.getStrategyId());
wrapper.getParameters().p... | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | wrapperForFeatureState | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public static FeatureState featureStateForWrapper(Feature feature, FeatureStateStorageWrapper wrapper) {
FeatureState featureState = new FeatureState(feature);
featureState.setEnabled(wrapper.isEnabled());
featureState.setStrategyId(wrapper.getStrategyId());
for (Map.Entry<String, String... | Wraps the state of a feature (minus the feature itself) to make it easier to store
the state of a feature in a cache and then recreate the FeatureState later.
This can help assist in the creation of StateRepositories in some circumstances
Created by ddcbdevins on 5/27/16. | featureStateForWrapper | java | togglz/togglz | core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/FeatureStateStorageWrapper.java | Apache-2.0 |
public static void close(InputStream s) {
if (s != null) {
try {
s.close();
} catch (IOException e) {
// ignore
}
}
} | Provides utility methods for working with I/O streams.
Based on com.google.common.io.* from com.google.guava:17.0
@author Chris Nokleberg
@author Colin Decker
@author Bin Zhu | close | java | togglz/togglz | core/src/main/java/org/togglz/core/util/IOUtils.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/IOUtils.java | Apache-2.0 |
public static long copy(InputStream from, OutputStream to) throws IOException {
checkNotNull(from);
checkNotNull(to);
byte[] buf = new byte[BUF_SIZE];
long total = 0;
while (true) {
int r = from.read(buf);
if (r == -1) {
break;
... | Copies all bytes from the input stream to the output stream.
Does not close or flush either stream.
@param from the input stream to read from
@param to the output stream to write to
@return the number of bytes copied
@throws IOException if an I/O error occurs | copy | java | togglz/togglz | core/src/main/java/org/togglz/core/util/IOUtils.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/IOUtils.java | Apache-2.0 |
public static String toString(Readable r) throws IOException {
StringBuilder sb = new StringBuilder();
copy(r, sb);
return sb.toString();
} | Reads all characters from a {@link Readable} object into a {@link String}.
Does not close the {@code Readable}.
@param r the object to read from
@return a string containing all the characters
@throws IOException if an I/O error occurs | toString | java | togglz/togglz | core/src/main/java/org/togglz/core/util/IOUtils.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/IOUtils.java | Apache-2.0 |
public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = CharBuffer.allocate(BUF_SIZE);
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total +=... | Copies all characters between the {@link Readable} and {@link Appendable}
objects. Does not close or flush either object.
@param from the object to read from
@param to the object to write to
@return the number of characters copied
@throws IOException if an I/O error occurs | copy | java | togglz/togglz | core/src/main/java/org/togglz/core/util/IOUtils.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/IOUtils.java | Apache-2.0 |
private static String simpleName(Class<?> clazz) {
String name = clazz.getName();
// the nth anonymous class has a class name ending in "Outer$n"
// and local inner classes have names ending in "Outer.$1Inner"
name = name.replaceAll("\\$[0-9]+", "\\$");
// we want the name of t... | {@link Class#getSimpleName()} is not GWT compatible yet, so we
provide our own implementation. | simpleName | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public static <T> T firstNonNull(T first, T second) {
return first != null ? first : checkNotNull(second);
} | Returns the first of two given parameters that is not {@code null}, if
either is, or otherwise throws a {@link NullPointerException}.
@return {@code first} if {@code first} is not {@code null}, or
{@code second} if {@code first} is {@code null} and {@code second} is
not {@code null}
@throws NullPointerException if bot... | firstNonNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, Object value) {
return addHolder(name, value);
} | Adds a name/value pair to the formatted output in {@code name=value}
format. If {@code value} is {@code null}, the string {@code "null"}
is used in which case this
name/value pair will not be added. | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, boolean value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, char value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, double value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, float value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, int value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
public ToStringHelper add(String name, long value) {
return addHolder(name, String.valueOf(value));
} | Adds a name/value pair to the formatted output in {@code name=value}
format.
@since 11.0 (source-compatible since 2.0) | add | java | togglz/togglz | core/src/main/java/org/togglz/core/util/MoreObjects.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/MoreObjects.java | Apache-2.0 |
@Override
public String name() {
return name;
} | This class can be used if just the name of a feature is known but not the enum type.
It doesn't try to lazily resolve the type when calling {@link #name()}.
@author Christian Kaltepoth | name | java | togglz/togglz | core/src/main/java/org/togglz/core/util/NamedFeature.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/NamedFeature.java | Apache-2.0 |
@Override
public int hashCode() {
return name.hashCode();
} | This class can be used if just the name of a feature is known but not the enum type.
It doesn't try to lazily resolve the type when calling {@link #name()}.
@author Christian Kaltepoth | hashCode | java | togglz/togglz | core/src/main/java/org/togglz/core/util/NamedFeature.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/NamedFeature.java | Apache-2.0 |
@Override
public boolean equals(Object o) {
return o instanceof NamedFeature && this.name.equals(((NamedFeature) o).name());
} | This class can be used if just the name of a feature is known but not the enum type.
It doesn't try to lazily resolve the type when calling {@link #name()}.
@author Christian Kaltepoth | equals | java | togglz/togglz | core/src/main/java/org/togglz/core/util/NamedFeature.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/NamedFeature.java | Apache-2.0 |
public static void checkArgument(boolean expression) {
if (!expression) {
throw new IllegalArgumentException();
}
} | Ensures the truth of an expression involving one or more parameters to the calling method.
@param expression a boolean expression
@throws IllegalArgumentException if {@code expression} is false | checkArgument | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean expression, Object errorMessage) {
if (!expression) {
throw new IllegalArgumentException(String.valueOf(errorMessage));
}
} | Ensures the truth of an expression involving one or more parameters to the calling method.
@param expression a boolean expression
@param errorMessage the exception message to use if the check fails; will be converted to a
string using {@link String#valueOf(Object)}
@throws IllegalArgumentExceptio... | checkArgument | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean expression,
String errorMessageTemplate,
Object... errorMessageArgs) {
if (!expression) {
throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
}
... | Ensures the truth of an expression involving one or more parameters to the calling method.
@param expression a boolean expression
@param errorMessageTemplate a template for the exception message should the check fail. The
message is formed by replacing each {@code %s} placeholder ... | checkArgument | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static void checkState(boolean expression) {
if (!expression) {
throw new IllegalStateException();
}
} | Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
@param expression a boolean expression
@throws IllegalStateException if {@code expression} is false | checkState | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static <T> T checkNotNull(T reference) {
if (reference == null) {
throw new NullPointerException();
}
return reference;
} | Ensures that an object reference passed as a parameter to the calling method is not null.
@param reference an object reference
@return the non-null reference that was validated
@throws NullPointerException if {@code reference} is null | checkNotNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static <T> T checkNotNull(T reference, Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
return reference;
} | Ensures that an object reference passed as a parameter to the calling method is not null.
@param reference an object reference
@param errorMessage the exception message to use if the check fails; will be converted to a
string using {@link String#valueOf(Object)}
@return the non-null reference th... | checkNotNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static <T> T checkNotNull(T reference,
String errorMessageTemplate,
Object... errorMessageArgs) {
if (reference == null) {
// If either of these parameters is null, the right thing happens anyway
throw new N... | Ensures that an object reference passed as a parameter to the calling method is not null.
@param reference an object reference
@param errorMessageTemplate a template for the exception message should the check fail. The
message is formed by replacing each {@code %s} placeholder in... | checkNotNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
static String format(String template, Object... args) {
template = String.valueOf(template); // null -> "null"
// start substituting the arguments into the '%s' placeholders
StringBuilder builder = new StringBuilder(template.length() + 16 * args.length);
int templateStart = 0;
i... | Substitutes each {@code %s} in {@code template} with an argument. These are matched by
position: the first {@code %s} gets {@code args[0]}, etc. If there are more arguments than
placeholders, the unmatched arguments will be appended to the end of the formatted message in
square braces.
@param template a non-null stri... | format | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Preconditions.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Preconditions.java | Apache-2.0 |
public static <E> Collection<E> get(Class<? extends E> service) {
Iterator<? extends E> implementations = ServiceLoader.load(service).iterator();
Collection<E> result = new ArrayList<E>();
while (implementations.hasNext()) {
result.add(implementations.next());
}
retu... | Lookup implementations of the supplied SPI. Please note that the order in which the implementations will occur in the
collection is not specified. | get | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Services.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Services.java | Apache-2.0 |
public static <E extends Weighted> List<E> getSorted(Class<? extends E> service) {
List<E> result = new ArrayList<E>(get(service));
result.sort(WEIGHTED_COMPARATOR);
return result;
} | Lookup implementations of the supplied SPI. This method requires the SPI to extends {@link Weighted} and therefore is
able to return a sorted list of implementations. | getSorted | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Services.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Services.java | Apache-2.0 |
public static boolean isEmpty(String s) {
return s == null || s.isEmpty();
} | <p>
Returns whether the specified string is empty while remaining null-safe.
</p>
@param s
the string to be checked (may be {@literal null})
@return {@literal true} if {@code s} is either {@literal null} or contains no characters. | isEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static boolean isNotEmpty(String s) {
return s != null && !s.isEmpty();
} | <p>
Returns whether the specified string is <b>not</b> empty while remaining null-safe.
</p>
@param s
the string to be checked (may be {@literal null})
@return {@literal true} if {@code s} is not {@literal null} and contains at least one character. | isNotEmpty | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static List<String> splitAndTrim(String value, String regex) {
List<String> result = new ArrayList<>();
if (isNotBlank(value)) {
String[] segements = value.split(regex);
for (String segment : segements) {
if (isNotBlank(segment)) {
resul... | <p>
Returns whether the specified string is <b>not</b> empty while remaining null-safe.
</p>
@param s
the string to be checked (may be {@literal null})
@return {@literal true} if {@code s} is not {@literal null} and contains at least one character. | splitAndTrim | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static String trim(String s) {
return s != null ? s.trim() : null;
} | <p>
Trims the specified string while remaining null-safe.
</p>
@param s
the string to be trimmed (may be {@literal null})
@return The trimmed {@code s} or {@literal null} if {@code s} is {@literal null}. | trim | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static String trimToNull(String s) {
s = trim(s);
return isNotEmpty(s) ? s : null;
} | <p>
Trims the specified string and, if the resulting string is empty, will return {@literal null} instead.
</p>
@param s
the string to be trimmed (may be {@literal null})
@return The trimmed {@code s} or {@literal null} if {@code s} is {@literal null} before or after being trimmed. | trimToNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static String joinClassNames(Iterable<?> iterable) {
StringBuilder result = new StringBuilder();
Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
result.append(it.next().getClass().getName());
if (it.hasNext()) {
result.append(", ");
... | <p>
Trims the specified string and, if the resulting string is empty, will return {@literal null} instead.
</p>
@param s
the string to be trimmed (may be {@literal null})
@return The trimmed {@code s} or {@literal null} if {@code s} is {@literal null} before or after being trimmed. | joinClassNames | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static Boolean toBoolean(String s) {
String value = trimToNull(s);
if (value == null) {
return null;
}
value = value.toLowerCase();
if (trueValues.contains(value)) {
return Boolean.TRUE;
}
if (falseValues.contains(value)) {
... | <p>
Attempts to return the best boolean representation for the specified string while remaining null-safe and
ignoring any leading/trailing whitespace as well as case.
</p>
<p>
This method simply uses a set of predefined values that it compares {@code s} to in order to determine the best
{@code Boolean} representation.... | toBoolean | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Strings.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Strings.java | Apache-2.0 |
public static void notBlank(String s, String msg) {
if (s == null || s.trim().length() == 0) {
throw new IllegalArgumentException(msg);
}
} | Common methods for checking method contracts.
@author Christian Kaltepoth | notBlank | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Validate.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Validate.java | Apache-2.0 |
public static void notNull(Object o, String msg) {
if (o == null) {
throw new IllegalArgumentException(msg);
}
} | Common methods for checking method contracts.
@author Christian Kaltepoth | notNull | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Validate.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Validate.java | Apache-2.0 |
public static void isTrue(boolean b, String msg) {
if (!b) {
throw new IllegalArgumentException(msg);
}
} | Common methods for checking method contracts.
@author Christian Kaltepoth | isTrue | java | togglz/togglz | core/src/main/java/org/togglz/core/util/Validate.java | https://github.com/togglz/togglz/blob/master/core/src/main/java/org/togglz/core/util/Validate.java | Apache-2.0 |
private String getMachineIP() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
while (interfaces.hasMoreElements()) {
Enumeration<InetAddress> addresses = interfaces.nextElement().get... | Returns the first IP of the current machine | getMachineIP | java | togglz/togglz | core/src/test/java/org/togglz/core/activation/IPActivationStrategyTest.java | https://github.com/togglz/togglz/blob/master/core/src/test/java/org/togglz/core/activation/IPActivationStrategyTest.java | Apache-2.0 |
@BeforeEach
void before() {
FeatureManager featureManager = new FeatureManagerBuilder()
.featureEnum(MyFeature.class)
.stateRepository(new InMemoryStateRepository())
.userProvider(new NoOpUserProvider())
.build();
ThreadLocalFeatureMana... | Binds a FeatureManager to the thread before starting each test | before | java | togglz/togglz | core/src/test/java/org/togglz/core/context/ThreadLocalFeatureManagerProviderTest.java | https://github.com/togglz/togglz/blob/master/core/src/test/java/org/togglz/core/context/ThreadLocalFeatureManagerProviderTest.java | Apache-2.0 |
void setFeatureUser(FeatureUser featureUser) {
this.featureUser = featureUser;
} | {@link UserProvider} that allows to set the user directly | setFeatureUser | java | togglz/togglz | core/src/test/java/org/togglz/core/manager/DefaultFeatureManagerTest.java | https://github.com/togglz/togglz/blob/master/core/src/test/java/org/togglz/core/manager/DefaultFeatureManagerTest.java | Apache-2.0 |
@Override
public FeatureUser getCurrentUser() {
return featureUser;
} | {@link UserProvider} that allows to set the user directly | getCurrentUser | java | togglz/togglz | core/src/test/java/org/togglz/core/manager/DefaultFeatureManagerTest.java | https://github.com/togglz/togglz/blob/master/core/src/test/java/org/togglz/core/manager/DefaultFeatureManagerTest.java | Apache-2.0 |
@Override
public FeatureState getFeatureState(Feature feature) {
GetItemRequest request = GetItemRequest.builder()
.key(Map.of(primaryKeyAttribute, AttributeValue.builder().s(feature.name()).build()))
.attributesToGet(FEATURE_STATE_ATTRIBUTE_NAME)
.tableName(t... | A state repository that uses Amazon's DynamoDB.
<p>
The repository is configured using the {@link DynamoDBStateRepositoryBuilder}
<p>
You must already have a table provisioned before you create this repository. | getFeatureState | java | togglz/togglz | dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | https://github.com/togglz/togglz/blob/master/dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | Apache-2.0 |
@Override
public void setFeatureState(FeatureState featureState) {
try {
String json = objectMapper.writeValueAsString(FeatureStateStorageWrapper.wrapperForFeatureState(featureState));
UpdateItemRequest request = UpdateItemRequest.builder()
.tableName(tableName)
... | A state repository that uses Amazon's DynamoDB.
<p>
The repository is configured using the {@link DynamoDBStateRepositoryBuilder}
<p>
You must already have a table provisioned before you create this repository. | setFeatureState | java | togglz/togglz | dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | https://github.com/togglz/togglz/blob/master/dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | Apache-2.0 |
public DynamoDBStateRepositoryBuilder withObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
return this;
} | <p>
Builder for a DynamoDBStateRepository.
</p>
<p>
<p>
Usage example:
</p>
<p>
<pre>
DynamoDBStateRepository dynamoDbStateRepository = new DynamoDBStateRepositoryBuilder(dbClient)
.withStateStoredInTable("togglz-state-storage")
.build();
</pre> | withObjectMapper | java | togglz/togglz | dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | https://github.com/togglz/togglz/blob/master/dynamodb/src/main/java/org/togglz/dynamodb/DynamoDBStateRepository.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.