/** * Creates a new initialized instance of Checksum * * @param cksumType The {@link CheckSumType} as an int * @param checksum The checksum as a byte[] */ public CheckSum(int cksumType, byte[] checksum) { this(CheckSumType.fromValue(cksumType), checksum); }
/** * Get the CheckSumType associated with a name. * * @param name The name of the CheckSumType we are looking for * @return The associated CheckSumType, or NONE if not found or if name is null */ public static CheckSumType fromName(String name) { if (name != null) { for (CheckSumType cs : values()) { if (cs.getName().equals(name)) { return cs; } } } return NONE; }
public static CheckSumTypeHandler getCheckSumHandler(String cksumType) throws KrbException { CheckSumType eTypeEnum = CheckSumType.fromName(cksumType); return getCheckSumHandler(eTypeEnum); }
@Override public String name() { return cksumType().getName(); }
/** * Set the {@link CheckSumType} * * @param cksumtype The {@link CheckSumType} to set */ public void setCksumtype(CheckSumType cksumtype) { setFieldAsInt(CheckSumField.CKSUM_TYPE, cksumtype.getValue()); }
@Override public String displayName() { return cksumType().getDisplayName(); }
/** * @see Object#hashCode() */ @Override public int hashCode() { int result = 17; if (getCksumtype() != null) { result = 31 * result + getCksumtype().hashCode(); } if (getChecksum() != null) { result = 31 * result + Arrays.hashCode(getChecksum()); } return result; }
/** * Get the CheckSumType associated with a value. * * @param value The integer value of the CheckSumType we are looking for * @return The associated CheckSumType, or NONE if not found or if value is null */ public static CheckSumType fromValue(Integer value) { if (value != null) { for (EnumType e : values()) { if (e.getValue() == value) { return (CheckSumType) e; } } } return NONE; }
String message = "Unsupported checksum type: " + cksumType.name(); throw new KrbException(KrbErrorCode.KDC_ERR_SUMTYPE_NOSUPP, message);
@Override public String name() { return cksumType().getName(); }
/** * Set the {@link CheckSumType} * * @param cksumtype The {@link CheckSumType} to set */ public void setCksumtype(CheckSumType cksumtype) { setFieldAsInt(CheckSumField.CKSUM_TYPE, cksumtype.getValue()); }
@Override public String displayName() { return cksumType().getDisplayName(); }
/** * @see Object#hashCode() */ @Override public int hashCode() { int result = 17; if (getCksumtype() != null) { result = 31 * result + getCksumtype().hashCode(); } if (getChecksum() != null) { result = 31 * result + Arrays.hashCode(getChecksum()); } return result; }
/** * Get the CheckSumType associated with a value. * * @param value The integer value of the CheckSumType we are looking for * @return The associated CheckSumType, or NONE if not found or if value is null */ public static CheckSumType fromValue(Integer value) { if (value != null) { for (EnumType e : values()) { if (e.getValue() == value) { return (CheckSumType) e; } } } return NONE; }
String message = "Unsupported checksum type: " + cksumType.name(); throw new KrbException(KrbErrorCode.KDC_ERR_SUMTYPE_NOSUPP, message);
/** * Creates a new initialized instance of Checksum * * @param cksumType The {@link CheckSumType} as an int * @param checksum The checksum as a byte[] */ public CheckSum(int cksumType, byte[] checksum) { this(CheckSumType.fromValue(cksumType), checksum); }
/** * Get the CheckSumType associated with a name. * * @param name The name of the CheckSumType we are looking for * @return The associated CheckSumType, or NONE if not found or if name is null */ public static CheckSumType fromName(String name) { if (name != null) { for (CheckSumType cs : values()) { if (cs.getName().equals(name)) { return cs; } } } return NONE; }
public static CheckSumTypeHandler getCheckSumHandler(String cksumType) throws KrbException { CheckSumType eTypeEnum = CheckSumType.fromName(cksumType); return getCheckSumHandler(eTypeEnum); }
public static CheckSumTypeHandler getCheckSumHandler(int cksumType) throws KrbException { CheckSumType eTypeEnum = CheckSumType.fromValue(cksumType); return getCheckSumHandler(eTypeEnum); }
/** * @return The {@link CheckSumType} used for this instance */ public CheckSumType getCksumtype() { Integer value = getFieldAsInteger(CheckSumField.CKSUM_TYPE); return CheckSumType.fromValue(value); }