Beispiel #1
0
  public Exportable(
      String linkName,
      String linkType,
      String linkVersion,
      String defaultValue,
      String[] list,
      Map<String, Element> attributesByNameMap,
      Map<String, Element> filtersByNameMap) {
    super(linkName, linkType, linkVersion, defaultValue, list);
    super.elementsList = new ArrayList<Element>();
    super.completeElementList = true;
    super.missingElement = false;
    for (String attributeName : this.elementNamesList) {
      Attribute attribute =
          (Attribute)
              attributesByNameMap.get(
                  attributeName.toLowerCase()); // to lower case because a few exceptions
      if (null == attribute) {
        attribute = new Attribute(attributeName);
        super.completeElementList = false;
        super.missingElement = true;
        // System.out.println("////////////////////////////////////////////////////////////////////////////////////////////");
      } else if (!attribute.field.isValid()) {
        super.completeElementList = false;
      }
      super.elementsList.add(attribute);
    }

    this.completeFiltersList = false;
    if (super.completeElementList) {
      populateFiltersList(attributesByNameMap, filtersByNameMap);
      populateFieldList();
    }
  }
Beispiel #2
0
 public synchronized void delete() {
   if (swigCPtr != 0) {
     if (swigCMemOwn) {
       swigCMemOwn = false;
       yarpJNI.delete_Sound(swigCPtr);
     }
     swigCPtr = 0;
   }
   super.delete();
 }
 @SuppressWarnings("unchecked")
 public Data toData(Object obj, PartitioningStrategy strategy) {
   if (obj == null) {
     return null;
   }
   if (obj instanceof Data) {
     return (Data) obj;
   }
   try {
     final SerializerAdapter serializer = serializerFor(obj.getClass());
     if (serializer == null) {
       if (active) {
         throw new HazelcastSerializationException(
             "There is no suitable serializer for " + obj.getClass());
       }
       throw new HazelcastInstanceNotActiveException();
     }
     final byte[] bytes = serializer.write(obj);
     final Data data = new Data(serializer.getTypeId(), bytes);
     if (obj instanceof Portable) {
       final Portable portable = (Portable) obj;
       data.classDefinition =
           serializationContext.lookup(portable.getFactoryId(), portable.getClassId());
     }
     if (strategy == null) {
       strategy = globalPartitioningStrategy;
     }
     if (strategy != null) {
       Object pk = strategy.getPartitionKey(obj);
       if (pk != null && pk != obj) {
         final Data partitionKey = toData(pk, EMPTY_PARTITIONING_STRATEGY);
         data.partitionHash = (partitionKey == null) ? -1 : partitionKey.getPartitionHash();
       }
     }
     return data;
   } catch (Throwable e) {
     handleException(e);
   }
   return null;
 }