/** * Get a clone of the Client Value * * @return a copy of the current value */ public StringValue clone() { return (StringValue)super.clone(); }
/** * Gets the normalized (canonical) representation for the wrapped value. * If the wrapped value is null, null is returned, otherwise the normalized * form is returned. If the normalized Value is null, then the wrapped * value is returned * * @return gets the normalized value */ public T getNormalizedValue() { if ( isNull() ) { return null; } if ( normalizedValue == null ) { return get(); } return getNormalizedValueCopy(); }
/** * Gets a normalizer using getMatchingRule() to resolve the matchingRule * that the normalizer is extracted from. * * @return a normalizer associated with the attributeType or null if one cannot be found * @throws LdapException if resolution of schema entities fail */ protected Normalizer getNormalizer() throws LdapException { if ( attributeType != null ) { MatchingRule mr = getMatchingRule(); if ( mr == null ) { return null; } return mr.getNormalizer(); } else { return null; } }
/** * Gets a reference to the the normalized (canonical) representation * for the wrapped value. * * @return gets a reference to the normalized value */ public T getNormalizedValueReference() { if ( isNull() ) { return null; } if ( normalizedValue == null ) { return wrappedValue; } return normalizedValue; }
/** * Uses the syntaxChecker associated with the attributeType to check if the * value is valid. Repeated calls to this method do not attempt to re-check * the syntax of the wrapped value every time if the wrapped value does not * change. Syntax checks only result on the first check, and when the wrapped * value changes. * * @see ServerValue#isValid() */ public final boolean isValid( SyntaxChecker syntaxChecker ) throws LdapException { if ( syntaxChecker == null ) { String message = I18n.err( I18n.ERR_04139, toString() ); LOG.error( message ); throw new LdapException( message ); } valid = syntaxChecker.isValidSyntax( getReference() ); return valid; }
/** * Uses the syntaxChecker associated with the attributeType to check if the * value is valid. Repeated calls to this method do not attempt to re-check * the syntax of the wrapped value every time if the wrapped value does not * change. Syntax checks only result on the first check, and when the wrapped * value changes. * * @see Value#isValid() */ public final boolean isValid() { if ( valid != null ) { return valid; } if ( attributeType != null ) { valid = attributeType.getSyntax().getSyntaxChecker().isValidSyntax( get() ); } else { valid = false; } return valid; }
public void apply( AttributeType attributeType ) { if ( this.attributeType != null ) { if ( !attributeType.equals( this.attributeType ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04476, attributeType.getName(), this.attributeType.getName() ) ); } else { return; } } this.attributeType = attributeType; try { normalize(); } catch ( LdapException ne ) { String message = I18n.err( I18n.ERR_04447, ne.getLocalizedMessage() ); LOG.info( message ); normalized = false; } }
/** * Gets a comparator using getMatchingRule() to resolve the matching * that the comparator is extracted from. * * @return a comparator associated with the attributeType or null if one cannot be found * @throws LdapException if resolution of schema entities fail */ protected LdapComparator<T> getLdapComparator() throws LdapException { if ( attributeType != null ) { MatchingRule mr = getMatchingRule(); if ( mr == null ) { return null; } return (LdapComparator<T>)mr.getLdapComparator(); } else { return null; } }
/** * @return a copy of the current value */ public BinaryValue clone() { BinaryValue clone = (BinaryValue)super.clone(); if ( normalizedValue != null ) { clone.normalizedValue = new byte[ normalizedValue.length ]; System.arraycopy( normalizedValue, 0, clone.normalizedValue, 0, normalizedValue.length ); } if ( wrappedValue != null ) { clone.wrappedValue = new byte[ wrappedValue.length ]; System.arraycopy( wrappedValue, 0, clone.wrappedValue, 0, wrappedValue.length ); } return clone; }