List of usage examples for java.lang Class equals
public boolean equals(Object obj)
From source file:org.syncope.core.security.SyncopeAuthenticationProvider.java
@Override public boolean supports(final Class<? extends Object> type) { return type.equals(UsernamePasswordAuthenticationToken.class); }
From source file:com.art4ul.jcoon.bean.RestClientInterfaceInvocationHandler.java
private String retrieveBaseUrl(Context context) { if (context.getParams().length != 1) { throw new InitializationException("@BaseUrl method should have only one argument."); }//from w w w . ja v a2 s . co m Class<?> argumentClass = context.getMethod().getParameterTypes()[0]; if (!argumentClass.equals(String.class)) { throw new InitializationException("@BaseUrl method argument should be String type only."); } return context.getParams()[0].toString(); }
From source file:com.adobe.acs.commons.util.impl.ValueMapTypeConverter.java
private boolean isCollectionTypeSupported(Class<?> collectionType) { return collectionType.equals(Collection.class) || collectionType.equals(List.class) || collectionType.equals(Set.class); }
From source file:com.zaradai.kunzite.trader.config.statics.digester.DateTimeConverter.java
@Override public Object convert(Class type, Object value) { checkNotNull(type, "Type cant be null"); checkNotNull(value, "Value cant be null"); checkArgument(type.equals(DateTime.class), "Conversion target must be Joda DateTime"); checkArgument(String.class.isAssignableFrom(value.getClass()), "Value should be a string, but is a %s", value.getClass());/*from ww w.j a va 2 s . c om*/ DateTime dateTime = formatter.parseDateTime((String) value); return dateTime; }
From source file:com.webpagebytes.cms.controllers.CleanerController.java
public <T> void notify(T t, AdminDataStorageOperation operation, Class<? extends Object> type) { try {/*from ww w . ja v a 2 s .co m*/ if (type.equals(WPBUri.class)) { WPBUrisCache urisCache = cacheFactory.getUrisCacheInstance(); urisCache.Refresh(); } if (type.equals(WPBPage.class)) { WPBPagesCache pagesCache = cacheFactory.getWebPagesCacheInstance(); pagesCache.Refresh(); } if (type.equals(WPBPageModule.class)) { WPBPageModulesCache modulesCache = cacheFactory.getPageModulesCacheInstance(); modulesCache.Refresh(); } if (type.equals(WPBMessage.class)) { WPBMessagesCache messagesCache = cacheFactory.getMessagesCacheInstance(); messagesCache.Refresh(); } if (type.equals(WPBArticle.class)) { WPBArticlesCache articlesCache = cacheFactory.getArticlesCacheInstance(); articlesCache.Refresh(); } if (type.equals(WPBFile.class)) { WPBFilesCache filesCache = cacheFactory.getFilesCacheInstance(); filesCache.Refresh(); } if (type.equals(WPBParameter.class)) { WPBParametersCache parametersCache = cacheFactory.getParametersCacheInstance(); parametersCache.Refresh(); } if (type.equals(WPBProject.class)) { WPBProjectCache projectCache = cacheFactory.getProjectCacheInstance(); projectCache.Refresh(); } } catch (WPBException e) { // do nothing } }
From source file:org.mitre.swd.view.JsonOpenIdConfigurationView.java
@Override protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {// w w w . j a v a2 s . c o m Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() { @Override public boolean shouldSkipField(FieldAttributes f) { return false; } @Override public boolean shouldSkipClass(Class<?> clazz) { // skip the JPA binding wrapper if (clazz.equals(BeanPropertyBindingResult.class)) { return true; } else { return false; } } }).create(); response.setContentType("application/json"); Object obj = model.get("entity"); if (obj == null) { obj = model; } Writer out; try { out = response.getWriter(); gson.toJson(obj, out); } catch (IOException e) { logger.error("IOException in JsonOpenIdConfigurationView.java: ", e); } }
From source file:com.xpfriend.fixture.cast.temp.ObjectOperatorBase.java
protected Object toArray(Class<?> componentType, String textValue) { if (componentType.equals(byte.class)) { return toByteArray(textValue); }//from www . j a v a 2 s.co m return toArrayInternal(componentType, textValue); }
From source file:ca.uhn.fhir.rest.method.ConditionalParamBinder.java
@Override public void initializeTypes(Method theMethod, Class<? extends Collection<?>> theOuterCollectionType, Class<? extends Collection<?>> theInnerCollectionType, Class<?> theParameterType) { if (theOuterCollectionType != null || theInnerCollectionType != null || theParameterType.equals(String.class) == false) { throw new ConfigurationException("Parameters annotated with @" + ConditionalUrlParam.class.getSimpleName() + " must be of type String, found incorrect parameteter in method \"" + theMethod + "\""); }//from w w w .j av a2s. c om }
From source file:com.qcadoo.model.internal.validators.LengthValidator.java
@Override public boolean call(final Entity entity, final Object oldValue, final Object newValue) { if (newValue == null) { return true; }//from w w w . j a v a 2 s . co m Class<?> fieldClass = fieldDefinition.getType().getType(); if (!fieldClass.equals(String.class)) { return true; } int length = newValue.toString().length(); return validateLength(fieldDefinition, entity, length); }
From source file:ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition.java
private void determineNativeType(Class<? extends IPrimitiveType<?>> theImplementingClass) { Class<?> clazz = theImplementingClass; while (clazz.equals(Object.class) == false) { Type type = clazz.getGenericSuperclass(); if (type instanceof ParameterizedType) { ParameterizedType superPt = (ParameterizedType) type; Type rawType = superPt.getRawType(); if (rawType instanceof Class) { Class<?> rawClass = (Class<?>) rawType; if (rawClass.getName().endsWith(".BasePrimitive") || rawClass.getName().endsWith(".PrimitiveType")) { Type typeVariable = superPt.getActualTypeArguments()[0]; if (typeVariable instanceof Class) { myNativeType = (Class<?>) typeVariable; break; }/* w ww . j a v a 2 s . co m*/ } } } clazz = clazz.getSuperclass(); } }