本文整理了Java中org.apache.sis.util.Workaround
类的一些代码示例,展示了Workaround
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Workaround
类的具体详情如下:
包路径:org.apache.sis.util.Workaround
类名称:Workaround
暂无
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Makes sure that the zero is positive. We do that in order to workaround a JDK 6 to 8 bug, where
* {@link AffineTransform#hashCode()} is inconsistent with {@link AffineTransform#equals(Object)}
* if there is zeros of opposite sign.
*
* <p>The inconsistency is in the use of {@link Double#doubleToLongBits(double)} for hash code and
* {@code ==} for testing equality. The former is sensitive to the sign of 0 while the later is not.</p>
*/
@Workaround(library="JDK", version="8") // Last verified in 1.8.0_05.
private static double pz(final double value) {
return (value != 0) ? value : 0;
}
代码示例来源:origin: apache/sis
/**
* Makes sure that the zero is positive. We do that in order to workaround a JDK 6 to 8 bug, where
* {@link AffineTransform#hashCode()} is inconsistent with {@link AffineTransform#equals(Object)}
* if there is zeros of opposite sign.
*
* <p>The inconsistency is in the use of {@link Double#doubleToLongBits(double)} for hash code and
* {@code ==} for testing equality. The former is sensitive to the sign of 0 while the later is not.</p>
*/
@Workaround(library="JDK", version="8") // Last verified in 1.8.0_05.
private static double pz(final double value) {
return (value != 0) ? value : 0;
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.7")
private static ParameterDescriptor<?>[] addAxisLengths(final ParameterDescriptor<?>[] parameters) {
final ParameterDescriptor<?>[] ext = new ParameterDescriptor<?>[parameters.length + 2];
ext[0] = MapProjection.SEMI_MAJOR;
ext[1] = MapProjection.SEMI_MINOR;
System.arraycopy(parameters, 0, ext, 2, parameters.length);
return ext;
}
代码示例来源:origin: apache/sis
/**
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.7")
private static ParameterDescriptor<?>[] addAxisLengths(final ParameterDescriptor<?>[] parameters) {
final ParameterDescriptor<?>[] ext = new ParameterDescriptor<?>[parameters.length + 2];
ext[0] = MapProjection.SEMI_MAJOR;
ext[1] = MapProjection.SEMI_MINOR;
System.arraycopy(parameters, 0, ext, 2, parameters.length);
return ext;
}
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private static short key(final Object[] parameters) {
final short key;
switch (parameters.length) {
case 1: key = Errors.Keys.UnexpectedEndOfString_1; break;
case 2: key = Errors.Keys.UnparsableStringForClass_2; break;
case 3: key = Errors.Keys.UnparsableStringForClass_3; break;
default: throw new AssertionError();
}
return key;
}
代码示例来源:origin: apache/sis
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private static short key(final Object[] parameters) {
final short key;
switch (parameters.length) {
case 1: key = Errors.Keys.UnexpectedEndOfString_1; break;
case 2: key = Errors.Keys.UnparsableStringForClass_2; break;
case 3: key = Errors.Keys.UnparsableStringForClass_3; break;
default: throw new AssertionError();
}
return key;
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Returns the region or timeframe in which this reference system is valid, or {@code null} if unspecified.
*
* @return area or region or timeframe in which this (coordinate) reference system is valid, or {@code null}.
*
* @see org.apache.sis.metadata.iso.extent.DefaultExtent
*/
@Override
@XmlElement(name = "domainOfValidity")
// For an unknown reason, JAXB does not take the adapter declared in package-info for this particular property.
@Workaround(library = "JDK", version = "1.8")
@XmlJavaTypeAdapter(EX_Extent.class)
public Extent getDomainOfValidity() {
return domainOfValidity;
}
代码示例来源:origin: apache/sis
/**
* Returns the region or timeframe in which this reference system is valid, or {@code null} if unspecified.
*
* @return area or region or timeframe in which this (coordinate) reference system is valid, or {@code null}.
*
* @see org.apache.sis.metadata.iso.extent.DefaultExtent
*/
@Override
@XmlElement(name = "domainOfValidity")
// For an unknown reason, JAXB does not take the adapter declared in package-info for this particular property.
@Workaround(library = "JDK", version = "1.8")
@XmlJavaTypeAdapter(EX_Extent.class)
public Extent getDomainOfValidity() {
return domainOfValidity;
}
代码示例来源:origin: apache/sis
/**
* Create an instance of {@code JAXBElement<AbstractGMLType>}}.
* The type declared in the method signature should be {@code AbstractGMLType}.
* However it is declared here as {@code Object} in order to avoid a dependency
* toward the GML module.
*
* @param value the GML {@code AbstractGMLType} value to wrap.
* @return the wrapped value.
*/
@Workaround(library = "JAXB", version = "2.1")
@XmlElementDecl(name = "AbstractGML",
namespace = Namespaces.GML,
substitutionHeadName = "AbstractObject",
substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?)
public JAXBElement<Object> createAbstractGML(final Object value) {
return new JAXBElement<>(AbstractGML_QNAME, Object.class, null, value);
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
/**
* Create an instance of {@code JAXBElement<AbstractGeometryType>}}.
* The type declared in the method signature should be {@code AbstractGeometryType}.
* However it is declared here as {@code Object} in order to avoid a dependency
* toward the GML module.
*
* @param value the {@code AbstractGeometryType} value to wrap.
* @return the wrapped value.
*/
@Workaround(library = "JAXB", version = "2.1")
@XmlElementDecl(name = "AbstractGeometry",
namespace = Namespaces.GML,
substitutionHeadName = "AbstractGML",
substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?)
public JAXBElement<Object> createAbstractGeometry(final Object value) {
return new JAXBElement<>(AbstractGeometry_QNAME, Object.class, null, value);
}
}
代码示例来源:origin: org.apache.sis.core/sis-metadata
/**
* Create an instance of {@code JAXBElement<AbstractGMLType>}}.
* The type declared in the method signature should be {@code AbstractGMLType}.
* However it is declared here as {@code Object} in order to avoid a dependency
* toward the GML module.
*
* @param value the GML {@code AbstractGMLType} value to wrap.
* @return the wrapped value.
*/
@Workaround(library = "JAXB", version = "2.1")
@XmlElementDecl(name = "AbstractGML",
namespace = Namespaces.GML,
substitutionHeadName = "AbstractObject",
substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?)
public JAXBElement<Object> createAbstractGML(final Object value) {
return new JAXBElement<>(AbstractGML_QNAME, Object.class, null, value);
}
代码示例来源:origin: apache/sis
/**
* Create an instance of {@code JAXBElement<AbstractGeometryType>}}.
* The type declared in the method signature should be {@code AbstractGeometryType}.
* However it is declared here as {@code Object} in order to avoid a dependency
* toward the GML module.
*
* @param value the {@code AbstractGeometryType} value to wrap.
* @return the wrapped value.
*/
@Workaround(library = "JAXB", version = "2.1")
@XmlElementDecl(name = "AbstractGeometry",
namespace = Namespaces.GML,
substitutionHeadName = "AbstractGML",
substitutionHeadNamespace = Namespaces.GML) // Not necessary according javadoc, but appears to be in practice (JAXB 2.1 bug?)
public JAXBElement<Object> createAbstractGeometry(final Object value) {
return new JAXBElement<>(AbstractGeometry_QNAME, Object.class, null, value);
}
}
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private LocalizedParseException(final Locale locale, final Class<?> type,
final CharSequence text, final int offset, final int errorOffset)
{
this(locale, parameters(type, text, offset, Math.max(offset, errorOffset)), errorOffset);
}
代码示例来源:origin: apache/sis
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private DataStoreException(final Locale locale, final Object[] params) {
this(locale, IOUtilities.errorMessageKey(params), params);
}
代码示例来源:origin: org.apache.sis.core/sis-utility
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private LocalizedParseException(final Locale locale, final Object[] parameters, final int errorOffset) {
this(locale, key(parameters), parameters, errorOffset);
}
代码示例来源:origin: org.apache.sis.storage/sis-storage
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private DataStoreException(final Locale locale, final Object[] params) {
this(locale, IOUtilities.errorMessageKey(params), params);
}
代码示例来源:origin: apache/sis
/**
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, CENTRAL_MERIDIAN);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
return new Initializer(method, parameters, roles, Initializer.AUTHALIC_RADIUS);
}
代码示例来源:origin: apache/sis
/**
* Workaround for RFE #4093999
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.8")
private LocalizedParseException(final Locale locale, final Class<?> type,
final CharSequence text, final int offset, final int errorOffset)
{
this(locale, parameters(type, text, offset, Math.max(offset, errorOffset)), errorOffset);
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.7")
private static Initializer initializer(final OperationMethod method, final Parameters parameters) {
final EnumMap<ParameterRole, ParameterDescriptor<Double>> roles = new EnumMap<>(ParameterRole.class);
roles.put(ParameterRole.CENTRAL_MERIDIAN, LONGITUDE_OF_ORIGIN);
roles.put(ParameterRole.SCALE_FACTOR, SCALE_FACTOR);
roles.put(ParameterRole.FALSE_EASTING, FALSE_EASTING);
roles.put(ParameterRole.FALSE_NORTHING, FALSE_NORTHING);
return new Initializer(method, parameters, roles, (byte) 0);
}
代码示例来源:origin: apache/sis
/**
* Work around for RFE #4093999 in Sun's bug database
* ("Relax constraint on placement of this()/super() call in constructors").
*/
@Workaround(library="JDK", version="1.7")
private static EnumSet<Option> options() {
final EnumSet<Option> options = MetadataCommand.options();
options.remove(Option.TIMEZONE);
options.remove(Option.FORMAT);
return options;
}
内容来源于网络,如有侵权,请联系作者删除!