/** * Fetch the current cached attributes. * <b>Note:</b> The returned object may not be modified! * * @return the current attributes * @deprecated You should use {@link #getSnapshotValue()} instead to get a * consistent value */ @Deprecated public Map<String, Variant> getAttributes () { return this.value.getAttributes (); }
/** * check if attributes are in the list * * @return <code>true</code> if the attributes list is not empty */ public synchronized boolean hasAttributes () { if ( this.value == null ) { return false; } return !this.value.getAttributes ().isEmpty (); }
/** * Fetch the current cached attributes. * <b>Note:</b> The returned object may not be modified! * * @return the current attributes * @deprecated You should use {@link #getSnapshotValue()} instead to get a * consistent value */ @Deprecated public Map<String, Variant> getAttributes () { return this.value.getAttributes (); }
/** * Checks if the current value has the attribute set * * @param attributeName * the attribute name to check * @return <code>true</code> if the current value is available and the * attribute is set */ protected boolean hasAttribute ( final String attributeName ) { final DataItemValue value = this.value; if ( value == null ) { return false; } if ( value.getAttributes () == null ) { return false; } return value.getAttributes ().containsKey ( attributeName ); }
protected boolean getBooleanAttribute ( final String name ) { if ( this.value.getAttributes ().containsKey ( name ) ) { return this.value.getAttributes ().get ( name ).asBoolean (); } return false; }
/** * Checks if the current value has the attribute set * * @param attributeName * the attribute name to check * @return <code>true</code> if the current value is available and the * attribute is set */ protected boolean hasAttribute ( final String attributeName ) { final DataItemValue value = this.value; if ( value == null ) { return false; } if ( value.getAttributes () == null ) { return false; } return value.getAttributes ().containsKey ( attributeName ); }
protected boolean getBooleanAttribute ( final String name ) { if ( this.value.getAttributes ().containsKey ( name ) ) { return this.value.getAttributes ().get ( name ).asBoolean (); } return false; }
public synchronized List<AttributePair> getAttributes () { if ( this.value == null ) { return new LinkedList<AttributePair> (); } final List<AttributePair> pairs = new ArrayList<AttributePair> ( this.value.getAttributes ().size () ); for ( final Map.Entry<String, Variant> entry : this.value.getAttributes ().entrySet () ) { pairs.add ( new AttributePair ( this.item, entry.getKey (), entry.getValue () ) ); } return pairs; }
public Variant getAttributeValue ( final String name, final String attributeName ) { final DataItemValue div = getValue ( name ); if ( div == null ) { return Variant.NULL; } else { final Variant attr = div.getAttributes ().get ( attributeName ); if ( attr == null ) { return Variant.NULL; } else { return attr; } } }
public Variant getAttributeValue ( final String name, final String attributeName ) { final DataItemValue div = getValue ( name ); if ( div == null ) { return Variant.NULL; } else { final Variant attr = div.getAttributes ().get ( attributeName ); if ( attr == null ) { return Variant.NULL; } else { return attr; } } }
private Set<Entry> convert ( final DataItemValue value ) { if ( value == null || value.getAttributes () == null ) { return Collections.emptySet (); } final Set<Entry> entries = new HashSet<AttributesPart.Entry> ( value.getAttributes ().size () ); for ( final Map.Entry<String, Variant> entry : value.getAttributes ().entrySet () ) { final Variant entryValue = entry.getValue (); if ( entryValue != null ) { entries.add ( new Entry ( entry.getKey (), entryValue.getType ().toString (), entryValue.toLabel () ) ); } else { entries.add ( new Entry ( entry.getKey (), null, null ) ); } } return entries; }
private Set<Entry> convert ( final DataItemValue value ) { if ( value == null || value.getAttributes () == null ) { return Collections.emptySet (); } final Set<Entry> entries = new HashSet<AttributesPart.Entry> ( value.getAttributes ().size () ); for ( final Map.Entry<String, Variant> entry : value.getAttributes ().entrySet () ) { final Variant entryValue = entry.getValue (); if ( entryValue != null ) { entries.add ( new Entry ( entry.getKey (), entryValue.getType ().toString (), entryValue.toLabel () ) ); } else { entries.add ( new Entry ( entry.getKey (), null, null ) ); } } return entries; }
public Builder ( final DataItemValue sourceValue ) { if ( sourceValue == null ) { this.value = Variant.NULL; this.attributes = new HashMap<String, Variant> (); this.subscriptionState = SubscriptionState.DISCONNECTED; } else { this.value = sourceValue.getValue (); this.attributes = new HashMap<String, Variant> ( sourceValue.getAttributes () ); this.subscriptionState = sourceValue.getSubscriptionState (); this.subscriptionError = sourceValue.getSubscriptionError (); } }
public Builder ( final DataItemValue sourceValue ) { if ( sourceValue == null ) { this.value = Variant.NULL; this.attributes = new HashMap<String, Variant> (); this.subscriptionState = SubscriptionState.DISCONNECTED; } else { this.value = sourceValue.getValue (); this.attributes = new HashMap<String, Variant> ( sourceValue.getAttributes () ); this.subscriptionState = sourceValue.getSubscriptionState (); this.subscriptionError = sourceValue.getSubscriptionError (); } }
public boolean isAttributeWithDefault ( final String name, final String attributeName, final boolean defaultValue ) { final DataItemValue div = getValue ( name ); if ( div == null ) { return defaultValue; } else { final Variant attr = div.getAttributes ().get ( attributeName ); if ( attr == null || attr.isNull () ) { return defaultValue; } else { return attr.asBoolean (); } } }
@Override public void run () { listener.notifySubscriptionChange ( SubscriptionState.CONNECTED, null ); listener.notifyDataChange ( value.getValue (), value.getAttributes (), false ); } } );
@Override public void run () { listener.notifySubscriptionChange ( SubscriptionState.CONNECTED, null ); listener.notifyDataChange ( value.getValue (), value.getAttributes (), true ); }; } );
public boolean isAttributeWithDefault ( final String name, final String attributeName, final boolean defaultValue ) { final DataItemValue div = getValue ( name ); if ( div == null ) { return defaultValue; } else { final Variant attr = div.getAttributes ().get ( attributeName ); if ( attr == null || attr.isNull () ) { return defaultValue; } else { return attr.asBoolean (); } } }
for ( final Map.Entry<String, Variant> entry : value.getAttributes ().entrySet () )
@Override public void run () { if ( state != ConnectionState.BOUND ) { listener.notifySubscriptionChange ( SubscriptionState.DISCONNECTED, null ); } else if ( value != null ) { listener.notifySubscriptionChange ( SubscriptionState.CONNECTED, null ); listener.notifyDataChange ( value.getValue (), value.getAttributes (), true ); } else { listener.notifySubscriptionChange ( SubscriptionState.GRANTED, null ); } } } );