Hints类,类似于对类的配置,我们来看一下代码的实现。

public class Hints extends RenderingHints {private static volatile Map<java.awt.RenderingHints.Key, Object> GLOBAL = new ConcurrentHashMap();private static AtomicBoolean needScan = new AtomicBoolean(true);public static final Hints.ClassKey CRS_AUTHORITY_FACTORY = new Hints.ClassKey("org.opengis.referencing.crs.CRSAuthorityFactory");public static final Hints.ClassKey CS_AUTHORITY_FACTORY = new Hints.ClassKey("org.opengis.referencing.cs.CSAuthorityFactory");public static final Hints.ClassKey DATUM_AUTHORITY_FACTORY = new Hints.ClassKey("org.opengis.referencing.datum.DatumAuthorityFactory");public static final Hints.ClassKey CRS_FACTORY = new Hints.ClassKey("org.opengis.referencing.crs.CRSFactory");public static final Hints.ClassKey CS_FACTORY = new Hints.ClassKey("org.opengis.referencing.cs.CSFactory");public static final Hints.ClassKey DATUM_FACTORY = new Hints.ClassKey("org.opengis.referencing.datum.DatumFactory");public static final Hints.ClassKey COORDINATE_OPERATION_FACTORY = new Hints.ClassKey("org.opengis.referencing.operation.CoordinateOperationFactory");public static final Hints.ClassKey COORDINATE_OPERATION_AUTHORITY_FACTORY = new Hints.ClassKey("org.opengis.referencing.operation.CoordinateOperationAuthorityFactory");public static final Hints.ClassKey MATH_TRANSFORM_FACTORY = new Hints.ClassKey("org.opengis.referencing.operation.MathTransformFactory");public static final Hints.Key DEFAULT_COORDINATE_REFERENCE_SYSTEM = new Hints.Key("org.opengis.referencing.crs.CoordinateReferenceSystem");public static final Hints.FileKey CRS_AUTHORITY_EXTRA_DIRECTORY = new Hints.FileKey(false);public static final Hints.Key EPSG_DATA_SOURCE = new Hints.DataSourceKey();public static final Hints.OptionKey DATUM_SHIFT_METHOD = new Hints.OptionKey(new String[]{"Molodenski", "Abridged_Molodenski", "Geocentric", "*"});public static final Hints.Key LENIENT_DATUM_SHIFT = new Hints.Key(Boolean.class);public static final Hints.Key FORCE_LONGITUDE_FIRST_AXIS_ORDER = new Hints.Key(Boolean.class);public static final Hints.Key FORCE_AXIS_ORDER_HONORING = new Hints.Key(String.class);public static final Hints.Key FORCE_STANDARD_AXIS_DIRECTIONS = new Hints.Key(Boolean.class);public static final Hints.Key FORCE_STANDARD_AXIS_UNITS = new Hints.Key(Boolean.class);public static final Hints.Key VERSION = new Hints.Key("org.geotools.util.Version");public static final Hints.Key ENTITY_RESOLVER = new Hints.Key(EntityResolver.class);public static final Hints.Key USE_PROVIDED_FID = new Hints.Key(Boolean.class);public static final Hints.Key PROVIDED_FID = new Hints.Key(String.class);public static final Hints.Key CRS = new Hints.Key("org.opengis.referencing.crs.CoordinateReferenceSystem");public static final Hints.Key PRECISION = new Hints.Key("org.opengis.geometry.Precision");public static final Hints.Key POSITION_FACTORY = new Hints.Key("org.opengis.geometry.PositionFactory");public static final Hints.Key GEOMETRY_FACTORY = new Hints.Key("org.opengis.geometry.coordinate.GeometryFactory");public static final Hints.Key LINEARIZATION_TOLERANCE = new Hints.Key(Double.class);public static final Hints.Key COMPLEX_FACTORY = new Hints.Key("org.opengis.geometry.complex.ComplexFactory");public static final Hints.Key AGGREGATE_FACTORY = new Hints.Key("org.opengis.geometry.aggregate.AggregateFactory");public static final Hints.Key PRIMITIVE_FACTORY = new Hints.Key("org.opengis.geometry.primitive.PrimitiveFactory");public static final Hints.Key GEOMETRY_VALIDATE = new Hints.Key(Boolean.class);public static final Hints.ClassKey JTS_GEOMETRY_FACTORY = new Hints.ClassKey("org.locationtech.jts.geom.GeometryFactory");public static final Hints.ClassKey JTS_COORDINATE_SEQUENCE_FACTORY = new Hints.ClassKey("org.locationtech.jts.geom.CoordinateSequenceFactory");public static final Hints.Key JTS_PRECISION_MODEL = new Hints.Key("org.locationtech.jts.geom.PrecisionModel");public static final Hints.Key JTS_SRID = new Hints.Key(Integer.class);public static Hints.ClassKey FEATURE_FACTORY = new Hints.ClassKey("org.opengis.feature.FeatureFactory");public static Hints.ClassKey FEATURE_TYPE_FACTORY = new Hints.ClassKey("org.opengis.feature.type.FeatureTypeFactory");public static final Hints.ClassKey FEATURE_LOCK_FACTORY = new Hints.ClassKey("org.geotools.data.FeatureLockFactory");public static final Hints.ClassKey FEATURE_COLLECTIONS = new Hints.ClassKey("org.geotools.feature.FeatureCollections");/** @deprecated */public static final Hints.Key FEATURE_TYPE_FACTORY_NAME = new Hints.Key(String.class);public static final Hints.Key FEATURE_DETACHED = new Hints.Key(Boolean.class);public static final Hints.Key FEATURE_2D = new Hints.Key(Boolean.class);public static final Hints.Key MAX_MEMORY_SORT = new Hints.Key(Integer.class);public static final Hints.Key GEOMETRY_DISTANCE = new Hints.Key(Double.class);public static final Hints.Key GEOMETRY_GENERALIZATION = new Hints.Key(Double.class);public static final Hints.Key GEOMETRY_SIMPLIFICATION = new Hints.Key(Double.class);public static final Hints.Key SCREENMAP = new Hints.ClassKey("org.geotools.renderer.ScreenMap");public static final Hints.Key COORDINATE_DIMENSION = new Hints.Key(Integer.class);public static final Hints.ClassKey STYLE_FACTORY = new Hints.ClassKey("org.geotools.styling.StyleFactory");public static final Hints.OptionKey COLOR_DEFINITION = new Hints.OptionKey(new String[]{"CSS"});public static final Hints.ClassKey ATTRIBUTE_TYPE_FACTORY = new Hints.ClassKey("org.geotools.feature.AttributeTypeFactory");public static final Hints.ClassKey FILTER_FACTORY = new Hints.ClassKey("org.opengis.filter.FilterFactory");public static final Hints.ClassKey VIRTUAL_TABLE_PARAMETERS = new Hints.ClassKey("java.util.Map");public static final Hints.Key MAX_ALLOWED_TILES = new Hints.Key(Integer.class);public static final Hints.Key MOSAIC_LOCATION_ATTRIBUTE = new Hints.Key(String.class);public static final Hints.Key USE_JAI_IMAGEREAD = new Hints.Key(Boolean.class);public static final Hints.Key OVERVIEW_POLICY = new Hints.Key("org.geotools.coverage.grid.io.OverviewPolicy");public static final Hints.Key DECIMATION_POLICY = new Hints.Key("org.geotools.coverage.grid.io.DecimationPolicy");public static final Hints.Key TILE_ENCODING = new Hints.Key(String.class);public static final Hints.Key JAI_INSTANCE = new Hints.Key("javax.media.jai.JAI");public static final Hints.Key SAMPLE_DIMENSION_TYPE = new Hints.Key("org.opengis.coverage.SampleDimensionType");public static final Hints.ClassKey GRID_COVERAGE_FACTORY = new Hints.ClassKey("org.geotools.coverage.grid.GridCoverageFactory");public static final Hints.ClassKey EXECUTOR_SERVICE = new Hints.ClassKey("java.util.concurrent.ExecutorService");public static final Hints.Key RESAMPLE_TOLERANCE = new Hints.Key(Double.class);public static final Hints.ClassKey REPOSITORY = new Hints.ClassKey("org.geotools.data.Repository");public static final Hints.Key RESOLVE = new Hints.Key("net.opengis.wfs20.ResolveValueType");public static final Hints.Key RESOLVE_TIMEOUT = new Hints.Key(Integer.class);public static final Hints.Key ASSOCIATION_TRAVERSAL_DEPTH = new Hints.Key(Integer.class);public static final Hints.Key ASSOCIATION_PROPERTY = new Hints.Key("org.opengis.filter.expression.PropertyName");public static final Hints.OptionKey CACHE_POLICY = new Hints.OptionKey(new String[]{"weak", "all", "fixed", "none", "default", "soft"});public static final Hints.IntegerKey CACHE_LIMIT = new Hints.IntegerKey(50);public static final Hints.IntegerKey AUTHORITY_MAX_ACTIVE = new Hints.IntegerKey(Runtime.getRuntime().availableProcessors() + 1);public static final Hints.IntegerKey AUTHORITY_MIN_IDLE = new Hints.IntegerKey(1);public static final Hints.IntegerKey AUTHORITY_MAX_IDLE = new Hints.IntegerKey(2);public static final Hints.IntegerKey AUTHORITY_MIN_EVICT_IDLETIME = new Hints.IntegerKey(120000);public static final Hints.IntegerKey AUTHORITY_SOFTMIN_EVICT_IDLETIME = new Hints.IntegerKey(10000);public static final Hints.IntegerKey AUTHORITY_TIME_BETWEEN_EVICTION_RUNS = new Hints.IntegerKey(5000);public static final Hints.DoubleKey COMPARISON_TOLERANCE = new Hints.DoubleKey(0.0D);public static final Hints.Key LOCAL_DATE_TIME_HANDLING = new Hints.Key(Boolean.class);public static final Hints.Key ENCODE_EWKT = new Hints.Key(Boolean.class);public Hints() {super((Map)null);}public Hints(java.awt.RenderingHints.Key key, Object value) {super((Map)null);super.put(key, value);}public Hints(java.awt.RenderingHints.Key key1, Object value1, java.awt.RenderingHints.Key key2, Object value2) {this(key1, value1);super.put(key2, value2);}/** @deprecated */@Deprecatedpublic Hints(java.awt.RenderingHints.Key key1, Object value1, Object[] pairs) {this(key1, value1);this.fromPairs(pairs);}public Hints(java.awt.RenderingHints.Key key1, Object value1, java.awt.RenderingHints.Key key2, Object value2, Object... pairs) {this(key1, value1, key2, value2);this.fromPairs(pairs);}private void fromPairs(Object[] pairs) throws IllegalArgumentException {if ((pairs.length & 1) != 0) {throw new IllegalArgumentException(Errors.format(149, pairs.length));} else {for(int i = 0; i < pairs.length; i += 2) {super.put(pairs[i], pairs[i + 1]);}}}public Hints(Map<? extends java.awt.RenderingHints.Key, ?> hints) {super(stripNonKeys(hints));}public Hints(RenderingHints hints) {super(stripNonKeys(hints));}static Map<java.awt.RenderingHints.Key, Object> stripNonKeys(Map<?, ?> hints) {if (hints == null) {return null;} else {Map<java.awt.RenderingHints.Key, Object> filtered = hints;Iterator it = hints.keySet().iterator();while(it.hasNext()) {Object key = it.next();if (!(key instanceof java.awt.RenderingHints.Key)) {if (filtered == hints) {filtered = new HashMap((Map)filtered);}((Map)filtered).remove(key);}}return (Map)filtered;}}public Hints clone() {return (Hints)super.clone();}public static void scanSystemProperties() {needScan.set(true);}private static boolean ensureSystemDefaultLoaded() {if (needScan.get()) {Map<java.awt.RenderingHints.Key, Object> newGlobal = new ConcurrentHashMap(GLOBAL);boolean modified = GeoTools.scanForSystemHints(newGlobal);GLOBAL = newGlobal;needScan.set(false);return modified;} else {return false;}}static Hints getDefaults(boolean strict) {boolean changed = ensureSystemDefaultLoaded();Object hints;if (strict) {hints = new StrictHints(GLOBAL);} else {hints = new Hints(GLOBAL);}if (changed) {GeoTools.fireConfigurationChanged();}return (Hints)hints;}static void putSystemDefault(RenderingHints hints) {ensureSystemDefaultLoaded();Map<java.awt.RenderingHints.Key, Object> map = toMap(hints);GLOBAL.putAll(map);GeoTools.fireConfigurationChanged();}private static Map<java.awt.RenderingHints.Key, Object> toMap(RenderingHints hints) {Map<java.awt.RenderingHints.Key, Object> result = new HashMap();Iterator var2 = hints.entrySet().iterator();while(var2.hasNext()) {Entry<Object, Object> entry = (Entry)var2.next();if (entry.getKey() instanceof java.awt.RenderingHints.Key) {result.put((java.awt.RenderingHints.Key)entry.getKey(), entry.getValue());}}return result;}public static Object getSystemDefault(java.awt.RenderingHints.Key key) {boolean changed = ensureSystemDefaultLoaded();Object value = GLOBAL.get(key);if (changed) {GeoTools.fireConfigurationChanged();}return value;}public static Object putSystemDefault(java.awt.RenderingHints.Key key, Object value) {boolean changed = ensureSystemDefaultLoaded();Object old = GLOBAL.put(key, value);if (changed || !Utilities.equals(value, old)) {GeoTools.fireConfigurationChanged();}return old;}public static Object removeSystemDefault(java.awt.RenderingHints.Key key) {boolean changed = ensureSystemDefaultLoaded();Object old = GLOBAL.remove(key);if (changed || old != null) {GeoTools.fireConfigurationChanged();}return old;}public String toString() {String lineSeparator = System.getProperty("line.separator", "\n");StringBuilder buffer = new StringBuilder("Hints:");buffer.append(lineSeparator).append(AbstractFactory.toString(this));Map<?, ?> extra = null;boolean changed = ensureSystemDefaultLoaded();if (!GLOBAL.isEmpty()) {extra = new HashMap(GLOBAL);}if (changed) {GeoTools.fireConfigurationChanged();}if (extra != null) {extra.keySet().removeAll(this.keySet());if (!extra.isEmpty()) {buffer.append("System defaults:").append(lineSeparator).append(AbstractFactory.toString(extra));}}return buffer.toString();}static String nameOf(java.awt.RenderingHints.Key key) {if (key instanceof Hints.Key) {return key.toString();} else {int var1 = 0;while(true) {Class type;switch(var1++) {case 0:type = RenderingHints.class;break;case 1:try {type = Class.forName("javax.media.jai.JAI");break;} catch (ClassNotFoundException var4) {;} catch (NoClassDefFoundError var5) {;}continue;default:return key.toString();}String name = nameOf(type, key);if (name != null) {return name;}}}}private static String nameOf(Class<?> type, java.awt.RenderingHints.Key key) {Field[] fields = type.getFields();for(int i = 0; i < fields.length; ++i) {Field f = fields[i];if (Modifier.isStatic(f.getModifiers())) {Object v;try {v = f.get((Object)null);} catch (IllegalAccessException var7) {continue;}if (v == key) {return f.getName();}}}return null;}public static final class ConfigurationMetadataKey extends Hints.Key {private static Map<String, Hints.ConfigurationMetadataKey> map = new HashMap();private ConfigurationMetadataKey(String key) {super(key);}public static Hints.ConfigurationMetadataKey get(String key) {Hints.ConfigurationMetadataKey ret = (Hints.ConfigurationMetadataKey)map.get(key);if (ret == null) {Class var2 = Hints.ConfigurationMetadataKey.class;synchronized(Hints.ConfigurationMetadataKey.class) {ret = (Hints.ConfigurationMetadataKey)map.get(key);if (ret == null) {ret = new Hints.ConfigurationMetadataKey(key);map.put(key, ret);}}}return ret;}public boolean isCompatibleValue(Object value) {return value != null;}}static final class DataSourceKey extends Hints.Key {public DataSourceKey() {super(DataSource.class);}public boolean isCompatibleValue(Object value) {return value instanceof DataSource || value instanceof String || value instanceof Name;}}public static final class OptionKey extends Hints.Key {private final Set<String> options;private final boolean wildcard;public OptionKey(String... alternatives) {super(String.class);Set<String> options = new TreeSet(Arrays.asList(alternatives));this.wildcard = options.remove("*");this.options = Collections.unmodifiableSet(options);}public Set<String> getOptions() {return this.options;}public boolean isCompatibleValue(Object value) {return this.wildcard ? value instanceof String : this.options.contains(value);}}public static final class DoubleKey extends Hints.Key {private final double number;public DoubleKey(double number) {super(Integer.class);this.number = number;}public double getDefault() {return this.number;}public double toValue(Hints hints) {if (hints != null) {Object value = hints.get(this);if (value instanceof Number) {return ((Number)value).doubleValue();}if (value instanceof CharSequence) {return Double.parseDouble(value.toString());}}return this.number;}public boolean isCompatibleValue(Object value) {if (!(value instanceof Float) && !(value instanceof Double)) {if (value instanceof String || value instanceof InternationalString) {try {Double.parseDouble(value.toString());} catch (NumberFormatException var3) {Logging.getLogger(Hints.DoubleKey.class).finer(var3.toString());}}return false;} else {return true;}}}public static final class IntegerKey extends Hints.Key {private final int number;public IntegerKey(int number) {super(Integer.class);this.number = number;}public int getDefault() {return this.number;}public int toValue(Hints hints) {if (hints != null) {Object value = hints.get(this);if (value instanceof Number) {return ((Number)value).intValue();}if (value instanceof CharSequence) {return Integer.parseInt(value.toString());}}return this.number;}public boolean isCompatibleValue(Object value) {if (!(value instanceof Short) && !(value instanceof Integer)) {if (value instanceof String || value instanceof InternationalString) {try {Integer.parseInt(value.toString());} catch (NumberFormatException var3) {Logging.getLogger(Hints.IntegerKey.class).finer(var3.toString());}}return false;} else {return true;}}}public static final class FileKey extends Hints.Key {private final boolean writable;public FileKey(boolean writable) {super(File.class);this.writable = writable;}public boolean isCompatibleValue(Object value) {File file;if (value instanceof File) {file = (File)value;} else {if (!(value instanceof String)) {return false;}file = new File((String)value);}if (file.exists()) {return !this.writable || file.canWrite();} else {File parent = file.getParentFile();return parent != null && parent.canWrite();}}}public static final class ClassKey extends Hints.Key {public ClassKey(Class<?> classe) {super(classe);}ClassKey(String className) {super(className);}public boolean isCompatibleValue(Object value) {if (value == null) {return false;} else if (value instanceof Class[]) {Class<?>[] types = (Class[])((Class[])value);for(int i = 0; i < types.length; ++i) {if (!this.isCompatibleValue(types[i])) {return false;}}return types.length != 0;} else if (value instanceof Class) {Class<?> type = (Class)value;Class<?> expected = this.getValueClass();if (expected.isAssignableFrom(type)) {return true;} else {if (expected.isInterface() && !type.isInterface()) {int modifiers = type.getModifiers();if (Modifier.isAbstract(modifiers) && !Modifier.isFinal(modifiers)) {return true;}}return false;}} else {return super.isCompatibleValue(value);}}}public static class Key extends java.awt.RenderingHints.Key {private static int count;private final String className;private transient Class<?> valueClass;public Key(Class<?> classe) {this(classe.getName());this.valueClass = classe;}Key(String className) {super(count());this.className = className;}private static synchronized int count() {return count++;}public Class<?> getValueClass() {if (this.valueClass == null) {try {this.valueClass = Class.forName(this.className);} catch (ClassNotFoundException var2) {Logging.unexpectedException(Hints.Key.class, "getValueClass", var2);this.valueClass = Object.class;}}return this.valueClass;}public boolean isCompatibleValue(Object value) {return this.getValueClass().isInstance(value);}public String toString() {int var1 = 0;String name;do {Class type;switch(var1++) {case 0:type = Hints.class;break;case 1:type = this.getValueClass();break;default:return super.toString();}name = Hints.nameOf(type, this);} while(name == null);return name;}}
}

geotool源码Hints提示类相关推荐

  1. 循序渐进,探寻Excel二次开发.NET源码(3)-ExcelBase类

    循序渐进,探寻Excel二次开发.NET源码(3)-ExcelBase类 --Excel打开关闭打印预览 作者:长江支流 关键字:.NET.Excel.Excel打开.Excel关闭.Excel打印预 ...

  2. JDK源码解析 InputStream类就使用了模板方法模式

    JDK源码解析 InputStream类就使用了模板方法模式. 在InputStream类中定义了多个 read() 方法,如下: public abstract class InputStream ...

  3. JDK源码解析 Integer类使用了享元模式

    JDK源码解析 Integer类使用了享元模式. 我们先看下面的例子: public class Demo {public static void main(String[] args) {Integ ...

  4. 读tomcat源码,随笔类图

    by yan 20170425 读tomcat源码,随笔类图:

  5. 源码学习-String类

    最近在扫描CodeDex时报了一个不能使用String.intern()的字符串来做锁对象的告警,对这个问题有疑问查了些资料,顺便学习一下String类的源码. 1.类定义 String 被final ...

  6. #UML# Astah+Doxygen 将C++源码映射为类图内成员只支持基本类型不支持自定义类型

    根据上篇文章#UML# Astah+Doxygen 将C++源码映射为类图,我们可以很轻松的将源码自动映射成类图, 然而在实际过程中,会发现生成的类图中,成员变量经常会有丢失的现象. 只支持基本类型不 ...

  7. 天气预报小程序源码,天气类微信小程序源码。API使用的是和风天气。

    天气预报小程序源码,天气类微信小程序源码.API使用的是和风天气. 可以提供实时全国天气气象信息,及时发布天气预报.灾害预警.气象云图.旅游天气.台风.暴雨雪等气象信息, 为我国的生产生活提供全面精确 ...

  8. enterprise architect (EA) 源码生成UML类图

    首先打开E-A,点击"文件"-"新建项目"-命名项目并选择项目保存目的地.完成上述操作后会弹出一个对话框"选择模型" 用VS看大型工程代码, ...

  9. JAVA23种设计模式学习,源码+案例分析+类图讲解

    本文对JAVA中23种设计模式进行了简单的讲解,幷加以实际案例进行辅助理解,每种模式都会举例说明,幷将源码开源至gitee和githbu上.JAVA目录下为源码,resources目录下的UML文件夹 ...

最新文章

  1. 制作精美的网站首页模板应该如何操作?
  2. DBvisualizer free 9.2.10 升级pro版本
  3. cms java垃圾回收_java cms垃圾回收器总结
  4. hpm128无法共享打印_打印机共享后不能打印的解决方法,文末有难题有高手能解决的?...
  5. 关闭mina服务_如何彻底关闭MINA客户端
  6. 又一起.NET程序挂死, 用 Windbg 抽丝剥茧式的真实案例分析
  7. SuppressLint黄色警告的原因以及解决办法
  8. php正则获取标签,PHP通过正则匹配中文字符 过滤html标签 获取文本内容
  9. 第七节:实战前必须掌握的10个指令(上)
  10. Win10安装python扩展的几种方式
  11. 【略有料】JDBC Statements, PreparedStatement和CallableStatement语句
  12. java io 内存增长_Java IO 总结
  13. 移动路由器做网站服务器,移动路由器上网方式选哪个?
  14. 找不到或无法加载主类 com.xxx.xxxxApplication
  15. mysql -关联查询与分组查询
  16. JVM: GC过程总结(minor GC 和 Full GC)
  17. 【开源教程1】疯壳·开源编队无人机-开机测试
  18. Linux 如何重启网络、禁用网卡
  19. springboot vue电影购票选座网站源码
  20. qt绘制网络拓补图(连接数据库,递归函数,无限绘制,可拖动节点)

热门文章

  1. 流程图用什么软件画?这三款工具很实用
  2. Activiti6.0实战-画流程图(1)
  3. EpsonL365无线连接问题
  4. IntelliJ IDEA 自动导入包设置
  5. [AHK]同花顺xiadan专业版全仓下单
  6. C#:KeyPress事件
  7. java输出空格_java 中的空格怎么写?
  8. winscp 列出‘/users‘的目录项时出错解决方法
  9. MainThread 和 RenderThread 解读
  10. 网游帧同步的分析与设计