protected String typeName() { if (name == null) { return Classes.getShortName(binding); } return name; }
/** * Compares two factories for order. This is used for sorting out the factories before to * display them. */ public int compare(final Class<?> factory1, final Class<?> factory2) { // Or sort by name return Classes.getShortName(factory1).compareToIgnoreCase(Classes.getShortName(factory2)); }
/** * Returns a short class name for the specified object. This method will omit the package name. * For example, it will return "String" instead of "java.lang.String" for a {@link String} * object. * * @param object The object (may be {@code null}). * @return A short class name for the specified object. */ public static String getShortClassName(final Object object) { return getShortName(getClass(object)); } }
/** * Format an error message saying that the specified factory is not yet supported. The error * message will be given to a {@link FactoryNotFoundException}. * * @param type The factory type requested by the users. */ private static String unsupportedFactory(final Class type) { return Errors.format(ErrorKeys.FACTORY_NOT_FOUND_$1, Classes.getShortName(type)); }
/** * Checks if the type is compatible with the expected one. This method is used as a safety by * {@code getFooAuthorityFactory(String)} methods in {@link URN_AuthorityFactory}. If a mismatch * is found, a warning is logged but no exception is thrown since it doesn't prevent the class * to work in a predictable way. It is just an indication for the user that his URN may be * wrong. */ final void logWarningIfTypeMismatch( AuthorityFactory authorityFactory, final Class<? extends AuthorityFactory> expected) { if (!expected.isAssignableFrom(type.type)) { // Build a simplified URN, omitting "urn:ogc:def" and version number. final LogRecord record = Loggings.format(Level.WARNING, LoggingKeys.MISMATCHED_URI_TYPE_$1, uri); // Set the source to the public or protected method. record.setSourceClassName(authorityFactory.getClass().getName()); record.setSourceMethodName("get" + Classes.getShortName(expected)); final Logger logger = AbstractAuthorityFactory.LOGGER; record.setLoggerName(logger.getName()); logger.log(record); } }
/** Invoked when a factory can't be loaded. Log a warning, but do not stop the process. */ private static void loadingFailure( final Class<?> category, final Throwable error, final boolean showStackTrace) { final String name = Classes.getShortName(category); final StringBuilder cause = new StringBuilder(Classes.getShortClassName(error)); final String message = error.getLocalizedMessage(); if (message != null) { cause.append(": "); cause.append(message); } final LogRecord record = Loggings.format( Level.WARNING, LoggingKeys.CANT_LOAD_SERVICE_$2, name, cause.toString()); if (showStackTrace) { record.setThrown(error); } record.setSourceClassName(FactoryRegistry.class.getName()); record.setSourceMethodName("scanForPlugins"); record.setLoggerName(LOGGER.getName()); LOGGER.log(record); }
/** * Returns the interpolation name for the specified interpolation object. This method tries to * infer the name from the object's class name. * * @param Interpolation The interpolation object, or {@code null} for "nearest" (which is an * other way to say "no interpolation"). */ public static String getInterpolationName(Interpolation interp) { if (interp == null) { interp = Interpolation.getInstance(Interpolation.INTERP_NEAREST); } final String prefix = "Interpolation"; for (Class<?> classe = interp.getClass(); classe != null; classe = classe.getSuperclass()) { String name = Classes.getShortName(classe); int index = name.lastIndexOf(prefix); if (index >= 0) { return name.substring(index + prefix.length()); } } return Classes.getShortClassName(interp); }
buffer.append(Utilities.spaces(Math.max(1, 7 - status.length()))) .append('(') .append(Classes.getShortName(category)); if (key != null) { buffer.append(", ").append(key); buffer.append(' ').append(Classes.getShortName(type)).append('.');
return Classes.getShortName(type);
/** * Returns the name of the GeoAPI interface implemented by the specified object. In addition, * the name may be added between brackets. */ private static String getClassName(final IdentifiedObject object) { if (object != null) { Class type = object.getClass(); final Class[] interfaces = type.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { final Class candidate = interfaces[i]; if (candidate.getName().startsWith("org.opengis.referencing.")) { type = candidate; break; } } String name = Classes.getShortName(type); final ReferenceIdentifier id = object.getName(); if (id != null) { name = name + '[' + id.getCode() + ']'; } return name; } return null; }
/** Returns a string representation of the specified object, for debugging purpose only. */ final String toString(final Class owner) { final AuthorityFactory factory = getAuthorityFactory(); return Classes.getShortName(owner) + '[' + Classes.getShortName(getType()) + " in " + Classes.getShortClassName(factory) + "(\"" + factory.getAuthority().getTitle() + "\")]"; }
sb.append(type.getName().getLocalPart()); sb.append(":"); sb.append(Classes.getShortName(type.getBinding())); sb.append(">");
sb.append(type.getName().getLocalPart()); sb.append(":"); sb.append(Classes.getShortName(type.getBinding())); sb.append(">");
sb.append(Classes.getShortName(binding)); sb.append(">");
sb.append(Classes.getShortName(binding)); sb.append(">");
/** Creates a tree for the specified metadata. */ public MutableTreeNode asTree(final Object metadata) { final String name = Classes.getShortName(standard.getInterface(metadata.getClass())); final DefaultMutableTreeNode root = OptionalDependencies.createTreeNode(localize(name), metadata, true); append(root, metadata); return root; }
array[i] = Classes.getShortName((Class<?>) element);
+ xpath + " as " + Classes.getShortName(checkBinding) + " cannot be assigned to " + Classes.getShortName(targetBinding));
table.write(Classes.getShortName(category)); table.nextColumn();
build.setName(Classes.getShortName(geometryClass)); build.setNillable(true); build.setCRS(crs);