@Override public Map<String, String> getAttributes(final RecordSchema schema) { final Map<String, String> attributes = new HashMap<>(4); final SchemaIdentifier id = schema.getIdentifier(); final Long schemaId = id.getIdentifier().getAsLong(); final Integer schemaVersion = id.getVersion().getAsInt(); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_ID_ATTRIBUTE, String.valueOf(schemaId)); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_VERSION_ATTRIBUTE, String.valueOf(schemaVersion)); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_PROTOCOL_VERSION_ATTRIBUTE, String.valueOf(LATEST_PROTOCOL_VERSION)); if (id.getBranch().isPresent()) { attributes.put(SCHEMA_BRANCH_ATTRIBUTE, id.getBranch().get()); } return attributes; }
@Override public Map<String, String> getAttributes(final RecordSchema schema) { final Map<String,String> attributes = new HashMap<>(3); final SchemaIdentifier identifier = schema.getIdentifier(); final Optional<String> nameOption = identifier.getName(); if (nameOption.isPresent()) { attributes.put(SCHEMA_NAME_ATTRIBUTE, nameOption.get()); } final OptionalInt versionOption = identifier.getVersion(); if (versionOption.isPresent()) { attributes.put(SCHEMA_VERSION_ATTRIBUTE, String.valueOf(versionOption.getAsInt())); } final Optional<String> branchOption = identifier.getBranch(); if (branchOption.isPresent()) { attributes.put(SCHEMA_BRANCH_ATTRIBUTE, branchOption.get()); } return attributes; }
@Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof SchemaIdentifier)) { return false; } final SchemaIdentifier other = (SchemaIdentifier) obj; return getName().equals(other.getName()) && getIdentifier().equals(other.getIdentifier()) && getVersion().equals(other.getVersion()) && getBranch().equals(other.getBranch()); }
final Optional<String> schemaBranchName = schemaIdentifier.getBranch(); final OptionalInt schemaVersion = schemaIdentifier.getVersion();
@Override public Map<String, String> getAttributes(final RecordSchema schema) { final Map<String, String> attributes = new HashMap<>(4); final SchemaIdentifier id = schema.getIdentifier(); final Long schemaId = id.getIdentifier().getAsLong(); final Integer schemaVersion = id.getVersion().getAsInt(); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_ID_ATTRIBUTE, String.valueOf(schemaId)); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_VERSION_ATTRIBUTE, String.valueOf(schemaVersion)); attributes.put(HortonworksAttributeSchemaReferenceStrategy.SCHEMA_PROTOCOL_VERSION_ATTRIBUTE, String.valueOf(LATEST_PROTOCOL_VERSION)); if (id.getBranch().isPresent()) { attributes.put(SCHEMA_BRANCH_ATTRIBUTE, id.getBranch().get()); } return attributes; }
@Override public Map<String, String> getAttributes(final RecordSchema schema) { final Map<String,String> attributes = new HashMap<>(3); final SchemaIdentifier identifier = schema.getIdentifier(); final Optional<String> nameOption = identifier.getName(); if (nameOption.isPresent()) { attributes.put(SCHEMA_NAME_ATTRIBUTE, nameOption.get()); } final OptionalInt versionOption = identifier.getVersion(); if (versionOption.isPresent()) { attributes.put(SCHEMA_VERSION_ATTRIBUTE, String.valueOf(versionOption.getAsInt())); } final Optional<String> branchOption = identifier.getBranch(); if (branchOption.isPresent()) { attributes.put(SCHEMA_BRANCH_ATTRIBUTE, branchOption.get()); } return attributes; }
@Override public boolean equals(final Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof SchemaIdentifier)) { return false; } final SchemaIdentifier other = (SchemaIdentifier) obj; return getName().equals(other.getName()) && getIdentifier().equals(other.getIdentifier()) && getVersion().equals(other.getVersion()) && getBranch().equals(other.getBranch()); }