本文整理了Java中org.apache.nifi.serialization.record.DataType.equals()
方法的一些代码示例,展示了DataType.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataType.equals()
方法的具体详情如下:
包路径:org.apache.nifi.serialization.record.DataType
类名称:DataType
方法名:equals
暂无
代码示例来源:origin: apache/nifi
public static boolean isArrayTypeCompatible(final Object value, final DataType elementDataType) {
return value != null
// Either an object array or a String to be converted to byte[]
&& (value instanceof Object[]
|| (value instanceof String && RecordFieldType.BYTE.getDataType().equals(elementDataType)));
}
代码示例来源:origin: apache/nifi
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RecordField other = (RecordField) obj;
return dataType.equals(other.getDataType()) && fieldName.equals(other.getFieldName()) && aliases.equals(other.getAliases()) && Objects.equals(defaultValue, other.defaultValue)
&& nullable == other.nullable;
}
代码示例来源:origin: apache/nifi
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MapDataType)) {
return false;
}
final MapDataType other = (MapDataType) obj;
return getValueType().equals(other.getValueType()) && Objects.equals(valueType, other.valueType);
}
代码示例来源:origin: apache/nifi
public static Object[] toArray(final Object value, final String fieldName, final DataType elementDataType, final Charset charset) {
if (value == null) {
return null;
}
if (value instanceof Object[]) {
return (Object[]) value;
}
if (value instanceof String && RecordFieldType.BYTE.getDataType().equals(elementDataType)) {
byte[] src = ((String) value).getBytes(charset);
Byte[] dest = new Byte[src.length];
for (int i = 0; i < src.length; i++) {
dest[i] = src[i];
}
return dest;
}
if (value instanceof byte[]) {
byte[] src = (byte[]) value;
Byte[] dest = new Byte[src.length];
for (int i = 0; i < src.length; i++) {
dest[i] = src[i];
}
return dest;
}
if (value instanceof List) {
final List<?> list = (List<?>)value;
return list.toArray();
}
throw new IllegalTypeConversionException("Cannot convert value [" + value + "] of type " + value.getClass() + " to Object Array for field " + fieldName);
}
代码示例来源:origin: apache/nifi
private static boolean isMergeRequired(final RecordField thisField, final RecordField otherField) {
if (!thisField.getDataType().equals(otherField.getDataType())) {
return true;
}
if (!thisField.getAliases().equals(otherField.getAliases())) {
return true;
}
if (!Objects.equals(thisField.getDefaultValue(), otherField.getDefaultValue())) {
return true;
}
return false;
}
代码示例来源:origin: apache/nifi
public static RecordField merge(final RecordField thisField, final RecordField otherField) {
final String fieldName = thisField.getFieldName();
final Set<String> aliases = new HashSet<>();
aliases.addAll(thisField.getAliases());
aliases.addAll(otherField.getAliases());
final Object defaultValue;
if (thisField.getDefaultValue() == null && otherField.getDefaultValue() != null) {
defaultValue = otherField.getDefaultValue();
} else {
defaultValue = thisField.getDefaultValue();
}
final DataType dataType;
if (thisField.getDataType().equals(otherField.getDataType())) {
dataType = thisField.getDataType();
} else {
dataType = RecordFieldType.CHOICE.getChoiceDataType(thisField.getDataType(), otherField.getDataType());
}
return new RecordField(fieldName, dataType, defaultValue, aliases, thisField.isNullable() || otherField.isNullable());
}
代码示例来源:origin: apache/nifi
if (RecordFieldType.BYTE.getDataType().equals(arrayDataType.getElementType())) {
return "BINARY";
代码示例来源:origin: apache/nifi
if (RecordFieldType.BYTE.getDataType().equals(arrayDataType.getElementType())) {
return TypeInfoFactory.getPrimitiveTypeInfo("binary");
代码示例来源:origin: org.apache.nifi/nifi-record
public static boolean isArrayTypeCompatible(final Object value, final DataType elementDataType) {
return value != null
// Either an object array or a String to be converted to byte[]
&& (value instanceof Object[]
|| (value instanceof String && RecordFieldType.BYTE.getDataType().equals(elementDataType)));
}
代码示例来源:origin: org.apache.nifi/nifi-record
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MapDataType)) {
return false;
}
final MapDataType other = (MapDataType) obj;
return getValueType().equals(other.getValueType()) && Objects.equals(valueType, other.valueType);
}
代码示例来源:origin: org.apache.nifi/nifi-record
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
RecordField other = (RecordField) obj;
return dataType.equals(other.getDataType()) && fieldName.equals(other.getFieldName()) && aliases.equals(other.getAliases()) && Objects.equals(defaultValue, other.defaultValue)
&& nullable == other.nullable;
}
代码示例来源:origin: org.apache.nifi/nifi-record
public static Object[] toArray(final Object value, final String fieldName, final DataType elementDataType, final Charset charset) {
if (value == null) {
return null;
}
if (value instanceof Object[]) {
return (Object[]) value;
}
if (value instanceof String && RecordFieldType.BYTE.getDataType().equals(elementDataType)) {
byte[] src = ((String) value).getBytes(charset);
Byte[] dest = new Byte[src.length];
for (int i = 0; i < src.length; i++) {
dest[i] = src[i];
}
return dest;
}
if (value instanceof byte[]) {
byte[] src = (byte[]) value;
Byte[] dest = new Byte[src.length];
for (int i = 0; i < src.length; i++) {
dest[i] = src[i];
}
return dest;
}
if (value instanceof List) {
final List<?> list = (List<?>)value;
return list.toArray();
}
throw new IllegalTypeConversionException("Cannot convert value [" + value + "] of type " + value.getClass() + " to Object Array for field " + fieldName);
}
代码示例来源:origin: org.apache.nifi/nifi-record
private static boolean isMergeRequired(final RecordField thisField, final RecordField otherField) {
if (!thisField.getDataType().equals(otherField.getDataType())) {
return true;
}
if (!thisField.getAliases().equals(otherField.getAliases())) {
return true;
}
if (!Objects.equals(thisField.getDefaultValue(), otherField.getDefaultValue())) {
return true;
}
return false;
}
代码示例来源:origin: org.apache.nifi/nifi-record
public static RecordField merge(final RecordField thisField, final RecordField otherField) {
final String fieldName = thisField.getFieldName();
final Set<String> aliases = new HashSet<>();
aliases.addAll(thisField.getAliases());
aliases.addAll(otherField.getAliases());
final Object defaultValue;
if (thisField.getDefaultValue() == null && otherField.getDefaultValue() != null) {
defaultValue = otherField.getDefaultValue();
} else {
defaultValue = thisField.getDefaultValue();
}
final DataType dataType;
if (thisField.getDataType().equals(otherField.getDataType())) {
dataType = thisField.getDataType();
} else {
dataType = RecordFieldType.CHOICE.getChoiceDataType(thisField.getDataType(), otherField.getDataType());
}
return new RecordField(fieldName, dataType, defaultValue, aliases, thisField.isNullable() || otherField.isNullable());
}
内容来源于网络,如有侵权,请联系作者删除!