Beispiel #1
0
  /** That should not be the right way to do it. */
  public void deserialize(
      final Exactness exactness,
      final InstanceBehavior beh,
      final TypeName type,
      final Atom pack,
      final TypeName toClass,
      final MethodReference inCall) {

    if (targets.containsKey(Target.INSTANTIATION)) {
      Object obj = targets.get(Target.INSTANTIATION);

      if (obj instanceof LoadedInstantiationBehavior) {
        final LoadedInstantiationBehavior lb = (LoadedInstantiationBehavior) obj;

        if (type != null) {
          lb.setBehavior(type, toClass, inCall, "", beh, exactness);
          // System.out.println("Setting Behavior of Type " + type + " to " + beh);
        } else {
          lb.setBehavior(pack, toClass, inCall, "", beh, exactness);
          // System.out.println("Setting Behavior of Pack " + pack + " to " + beh);
        }
      } else {
        throw new UnsupportedOperationException(
            "Can only deserialize to a LoadedInstantiationBehavior, got " + obj.getClass());
      }
    }
  }
Beispiel #2
0
 public void deserialize(final InstanceBehavior beh) {
   Object obj = targets.get(Target.INSTANTIATION);
   if (obj instanceof LoadedInstantiationBehavior) {
     final LoadedInstantiationBehavior lb = (LoadedInstantiationBehavior) obj;
     lb.setDefaultBehavior(beh);
   } else {
     throw new UnsupportedOperationException(
         "Can only deserialize to a LoadedInstantiationBehavior, got " + obj.getClass());
   }
 }