Java Class.equals Examples

Java Class.equals - 30 examples found. These are the top rated real world Java examples of Class.equals extracted from open source projects. You can rate examples to help us improve the quality of examples.
 @Override
 public boolean isWrapperFor(Class<?> iface) throws SQLException {
   if (iface.equals(Supported.class) || (iface.equals(DataSource.class))) {
     return true;
   }
   return false;
 }
Example #2
0
 private static Object[] buildArgs(
     PojoPathParam[] pathParams,
     Map<String, String> pathParameters,
     Session session,
     EndpointConfig config,
     Throwable throwable,
     CloseReason closeReason)
     throws DecodeException {
   Object[] result = new Object[pathParams.length];
   for (int i = 0; i < pathParams.length; i++) {
     Class<?> type = pathParams[i].getType();
     if (type.equals(Session.class)) {
       result[i] = session;
     } else if (type.equals(EndpointConfig.class)) {
       result[i] = config;
     } else if (type.equals(Throwable.class)) {
       result[i] = throwable;
     } else if (type.equals(CloseReason.class)) {
       result[i] = closeReason;
     } else {
       String name = pathParams[i].getName();
       String value = pathParameters.get(name);
       try {
         result[i] = Util.coerceToType(type, value);
       } catch (Exception e) {
         throw new DecodeException(
             value, sm.getString("pojoMethodMapping.decodePathParamFail", value, type), e);
       }
     }
   }
   return result;
 }
Example #3
0
 private static TerminalFactory loadFactory(String pn, String type)
     throws NoSuchAlgorithmException {
   TerminalFactory tf = null;
   try {
     Class<?> cls = Class.forName(pn);
     Provider p = (Provider) cls.getConstructor().newInstance();
     tf = TerminalFactory.getInstance(type == null ? "PC/SC" : type, null, p);
   } catch (ClassNotFoundException
       | InstantiationException
       | IllegalAccessException
       | IllegalArgumentException
       | InvocationTargetException
       | NoSuchMethodException
       | SecurityException e) {
     throw new RuntimeException("Could not load " + pn, e);
   } catch (NoSuchAlgorithmException e) {
     if (e.getCause() != null) {
       Class<?> cause = e.getCause().getClass();
       if (cause.equals(java.lang.UnsupportedOperationException.class)) {
         throw new NoSuchAlgorithmException(e.getCause().getMessage());
       }
       if (cause.equals(java.lang.UnsatisfiedLinkError.class)) {
         throw new NoSuchAlgorithmException(e.getCause().getMessage());
       }
     }
     throw e;
   }
   return tf;
 }
Example #4
0
 public boolean isAutoIncreaseType() {
   Class idType = this.getColumnField().getType();
   return idType.equals(int.class)
       || idType.equals(Integer.class)
       || idType.equals(long.class)
       || idType.equals(Long.class);
 }
Example #5
0
  private List<ServiceFunctionDictionary> createSfDictList(
      ServiceFunction sf, Class<? extends SlTransportType> transportType) {
    // For MPLS and MAC transport types, we want the SF to be MAC/VLAN
    Class<? extends SlTransportType> sfTransportType =
        (transportType.equals(VxlanGpe.class) ? transportType : Mac.class);

    SffSfDataPlaneLocatorBuilder sffSfDplBuilder = new SffSfDataPlaneLocatorBuilder();
    // TODO the vlanId needs to be the same as on the SF
    sffSfDplBuilder.setLocatorType(buildSfLocatorType(sfTransportType));
    sffSfDplBuilder.setTransport(sfTransportType);

    ServiceFunctionDictionaryBuilder sfDictBuilder = new ServiceFunctionDictionaryBuilder();
    sfDictBuilder.setName(sf.getName());
    sfDictBuilder.setType(sf.getType());
    sfDictBuilder.setSffSfDataPlaneLocator(sffSfDplBuilder.build());
    sfDictBuilder.setKey(new ServiceFunctionDictionaryKey(sf.getName()));

    // Augment the dictionary with an OfsPortBuilder if its not VxLan
    if (!transportType.equals(VxlanGpe.class)) {
      ServiceFunctionDictionary1Builder ofsSfDictBuilder = new ServiceFunctionDictionary1Builder();
      OfsPortBuilder ofsPortBuilder = new OfsPortBuilder();
      ofsPortBuilder.setMacAddress(new MacAddress(getNextMacAddress()));
      ofsPortBuilder.setPortId(SWITCH_PORT_STR);
      ofsSfDictBuilder.setOfsPort(ofsPortBuilder.build());
      sfDictBuilder.addAugmentation(ServiceFunctionDictionary1.class, ofsSfDictBuilder.build());
    }

    List<ServiceFunctionDictionary> sfDictList = new ArrayList<ServiceFunctionDictionary>();
    sfDictList.add(sfDictBuilder.build());

    return sfDictList;
  }
Example #6
0
  @Override
  public Set<Element> get(Object key) {
    Get get = new Get(ByteArraySerializer.fromObject(key));
    Result result;
    try {
      result = backingTable.get(get);
    } catch (IOException e) {
      LOG.severe("Cannot get from backing table");
      e.printStackTrace();
      return null;
    }

    NavigableMap<byte[], byte[]> map = result.getFamilyMap(Bytes.toBytes(VALUES));
    if (null == map) return null;

    HashSet<Element> elementHashSet = new HashSet<Element>();

    for (byte[] byteArray : map.keySet()) {

      if (indexClass.equals(HVertex.class) || indexClass.equals(Vertex.class)) {
        HVertex hVertex = new HVertex(hGraph);
        hVertex.setId(byteArray);
        elementHashSet.add(hVertex);
      } else {
        final HEdge hEdge = new HEdge(hGraph);
        hEdge.setId(byteArray);
        elementHashSet.add(hEdge);
      }
    }

    return elementHashSet;
  }