Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.oneandone.network.snmpman.configuration.type;
 
 
The modifier properties as used in com.oneandone.network.snmpman.configuration.Device for initialization.
 
 public class ModifierProperties extends Properties {

    
Returns the integer value for the specified property key.

Parameters:
key the property key
Returns:
the integer value for the specified key
Throws:
java.lang.ClassCastException thrown if the value for the specified key could not be casted
    public Integer getInteger(final String key) {
        final Optional<Numbernumber = getNumber(key);
        return number.isPresent() ? number.get().intValue() : null;
    }

    
Returns the long value for the specified property key.

Parameters:
key the property key
Returns:
the long value for the specified key
Throws:
java.lang.ClassCastException thrown if the value for the specified key could not be casted
    public Long getLong(final String key) {
        final Optional<Numbernumber = getNumber(key);
        return number.isPresent() ? number.get().longValue() : null;
    }

    
Returns the unsigned long value for the specified property key.

Parameters:
key the property key
Returns:
the unsigned long value for the specified key
Throws:
java.lang.ClassCastException thrown if the value for the specified key could not be casted
    public UnsignedLong getUnsignedLong(final String key) {
        final Optional<Numbernumber = getNumber(key);
        return number.isPresent() ? UnsignedLong.valueOf(number.get().longValue()) : null;
    }

    
Returns the number for the specified property key.

Parameters:
key the property key
Returns:
the number for the specified key
Throws:
java.lang.ClassCastException thrown if the value for the specified key could not be casted
    private Optional<NumbergetNumber(final String key) {
        if (this.containsKey(key)) {
            final Object value = this.get(key);
            if (value instanceof Number) {
                return Optional.of((Numbervalue);
            } else {
                throw new ClassCastException("property \"" + key + "\" is not a number");
            }
        }
        return Optional.empty();
    }
New to GrepCode? Check out our FAQ X