Polish JavaFormat in Core

This commit is contained in:
Josh Cummings
2023-05-09 13:46:10 -06:00
parent e854fafcfe
commit ec6aeff6a1
6 changed files with 51 additions and 51 deletions

View File

@@ -299,26 +299,6 @@ public class DistinguishedName implements Name {
return this.names;
}
/**
* Get the String representation of this <code>DistinguishedName</code>. Depending on
* the setting of property <code>org.springframework.ldap.core.spacedDnFormat</code> a
* space will be added after each comma, to make the result more readable. Default is
* compact representation, i.e. without any spaces.
* @return a syntactically correct, properly escaped String representation of the
* <code>DistinguishedName</code>.
* @see #SPACED_DN_FORMAT_PROPERTY
*/
@Override
public String toString() {
String spacedFormatting = System.getProperty(SPACED_DN_FORMAT_PROPERTY);
if (!StringUtils.hasText(spacedFormatting)) {
return format(COMPACT);
}
else {
return format(NON_COMPACT);
}
}
/**
* Get the compact String representation of this <code>DistinguishedName</code>. Add
* no space after each comma, to make it compact.
@@ -544,6 +524,26 @@ public class DistinguishedName implements Name {
return this.getClass().hashCode() ^ getNames().hashCode();
}
/**
* Get the String representation of this <code>DistinguishedName</code>. Depending on
* the setting of property <code>org.springframework.ldap.core.spacedDnFormat</code> a
* space will be added after each comma, to make the result more readable. Default is
* compact representation, i.e. without any spaces.
* @return a syntactically correct, properly escaped String representation of the
* <code>DistinguishedName</code>.
* @see #SPACED_DN_FORMAT_PROPERTY
*/
@Override
public String toString() {
String spacedFormatting = System.getProperty(SPACED_DN_FORMAT_PROPERTY);
if (!StringUtils.hasText(spacedFormatting)) {
return format(COMPACT);
}
else {
return format(NON_COMPACT);
}
}
/**
* Compare this instance to another object. Note that the comparison is done in order
* of significance, so the most significant Rdn is compared first, then the second and

View File

@@ -149,16 +149,6 @@ public class LdapRdnComponent implements Comparable, Serializable {
return buff.toString();
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getLdapEncoded();
}
/**
* @return The LdapRdn as a string where the value is LDAP-encoded.
*/
@@ -182,16 +172,6 @@ public class LdapRdnComponent implements Comparable, Serializable {
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return this.key.toUpperCase().hashCode() ^ this.value.toUpperCase().hashCode();
}
/*
* (non-Javadoc)
*
@@ -213,6 +193,26 @@ public class LdapRdnComponent implements Comparable, Serializable {
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return this.key.toUpperCase().hashCode() ^ this.value.toUpperCase().hashCode();
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return getLdapEncoded();
}
/**
* Compare this instance to the supplied object.
* @param obj the object to compare to.

View File

@@ -82,14 +82,6 @@ class RangeOption implements Comparable<RangeOption> {
return getInitial() == 0 && getTerminal() == TERMINAL_END_OF_RANGE;
}
@Override
public String toString() {
StringBuilder rangeBuilder = new StringBuilder();
appendTo(rangeBuilder);
return rangeBuilder.toString();
}
void appendTo(StringBuilder rangeBuilder) {
rangeBuilder.append("Range=").append(this.initial);
@@ -191,6 +183,14 @@ class RangeOption implements Comparable<RangeOption> {
return result;
}
@Override
public String toString() {
StringBuilder rangeBuilder = new StringBuilder();
appendTo(rangeBuilder);
return rangeBuilder.toString();
}
RangeOption nextRange(int pageSize) {
if (getTerminal() < 0) {
throw new IllegalStateException("Cannot generate next range, range-terminal: " + getTerminal());

View File

@@ -23,7 +23,7 @@ package org.springframework.ldap.filter;
* AndFilter filter = new AndFilter();
* filter.and(new EqualsFilter(&quot;objectclass&quot;, &quot;person&quot;);
* filter.and(new EqualsFilter(&quot;cn&quot;, &quot;Some CN&quot;);
* System.out.println(filter.encode());
* System.out.println(filter.encode());
* </pre>
*
* would result in: <code>(&amp;(objectclass=person)(cn=Some CN))</code>

View File

@@ -23,7 +23,7 @@ package org.springframework.ldap.filter;
* OrFilter filter = new OrFilter();
* filter.or(new EqualsFilter(&quot;objectclass&quot;, &quot;person&quot;);
* filter.or(new EqualsFilter(&quot;objectclass&quot;, &quot;organizationalUnit&quot;);
* System.out.println(filter.encode());
* System.out.println(filter.encode());
* </pre>
*
* would result in: <code>(|(objectclass=person)(objectclass=organizationalUnit))</code>

View File

@@ -596,7 +596,7 @@ public final class LdapUtils {
* dddd (four bytes of &quot;d&quot; treated as a 32-bit number in little-endian format)
* eeee (four bytes of &quot;e&quot; treated as a 32-bit number in little-endian format)
* ffff (four bytes of &quot;f&quot; treated as a 32-bit number in little-endian format)
* etc.
* etc.
*
* So for example, if your SID is S-1-5-21-2127521184-1604012920-1887927527-72713, then your raw hex SID is
*