org.babyfish.lang.Arguments.mustBeInstanceOfValue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.babyfish.lang.Arguments.mustBeInstanceOfValue()方法的一些代码示例,展示了Arguments.mustBeInstanceOfValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arguments.mustBeInstanceOfValue()方法的具体详情如下:
包路径:org.babyfish.lang.Arguments
类名称:Arguments
方法名:mustBeInstanceOfValue

Arguments.mustBeInstanceOfValue介绍

暂无

代码示例

代码示例来源:origin: babyfish-ct/babyfish

@Override
public void validate(Object e) {
  if (e != null) {
    Arguments.mustBeInstanceOfValue("e", e, this.restrctionType);
  }
}

代码示例来源:origin: babyfish-ct/babyfish

@Override
public <E, C extends Collection<E>> Predicate isMember(
    Expression<E> elem, Expression<C> collection) {
  Arguments.mustBeInstanceOfValue("collection", collection, PluralAttributePath.class);
  return new IsMemberPredicate<E, C>(this, elem, (PluralAttributePath<C>)collection);
}

代码示例来源:origin: babyfish-ct/babyfish

@Override
public <C extends Collection<?>> Predicate isEmpty(Expression<C> collection) {
  Arguments.mustBeInstanceOfValue("collection", collection, PluralAttributePath.class);
  return new IsEmptyPredicate<C>(this, (PluralAttributePath<C>)collection);
}

代码示例来源:origin: babyfish-ct/babyfish

@Override
public <C extends Collection<?>> Expression<Integer> size(Expression<C> collection) {
  if (!(collection instanceof PluralAttributePath<?>)) {
    Arguments.mustBeInstanceOfValue("collection", collection, PluralAttributePath.class);
  }
  return new SizeExpression<C>(this, (PluralAttributePath<C>)collection);
}

代码示例来源:origin: babyfish-ct/babyfish

protected static <T, S extends Selection<T>> S mustUnderSameCriteriaBuilder(
    CriteriaBuilder criteriaBuilder,
    String argumentName, S argumentValue) {
  if (argumentValue != null) {
    if (!(argumentValue instanceof AbstractNode)) {
      Arguments.mustBeInstanceOfValue("argumentName", argumentValue, AbstractNode.class);
    }
    if (criteriaBuilder != ((AbstractNode)argumentValue).criteriaBuilder) {
      throw new IllegalArgumentException(
          childNodeMustUnderTheSameCriteriaBuilder(
              argumentName,
              XCriteriaBuilder.class
          )
      );
    }
  }
  return argumentValue;
}

代码示例来源:origin: babyfish-ct/babyfish

public static XSharedSessionBuilderImplementor wrap(SharedSessionBuilder sharedSessionBuilder, XSessionFactory factory) {
  if (sharedSessionBuilder instanceof XSharedSessionBuilderImplementor) {
    return (XSharedSessionBuilderImplementor)sharedSessionBuilder;
  }
  return (XSharedSessionBuilderImplementor)INSTANCE.createProxy(
      Arguments.mustBeInstanceOfValue("sharedSessionBuilder", sharedSessionBuilder, SessionBuilderImplementor.class),
      Arguments.mustNotBeNull("factory", factory)
  );
}

代码示例来源:origin: babyfish-ct/babyfish

public static XSessionBuilderImplementor wrap(SessionBuilder sessionBuilder, XSessionFactory factory) {
  if (sessionBuilder instanceof XSessionBuilderImplementor) {
    return (XSessionBuilderImplementor)sessionBuilder;
  }
  return (XSessionBuilderImplementor)INSTANCE.createProxy(
      Arguments.mustBeInstanceOfValue("sessionBuilder", sessionBuilder, SessionBuilderImplementor.class),
      Arguments.mustNotBeNull("factory", factory)
  );
}

代码示例来源:origin: babyfish-ct/babyfish

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <X, T extends X> Path<T> treat(Path<X> path, Class<T> type) {
  if (path instanceof Join<?, ?>) {
    return this.treat((Join)path, type);
  }
  Arguments.mustBeInstanceOfValue("path", path, SingularAttributePath.class);
  return new TreatedSingularAttributePath<>((SingularAttributePath<X>)path, type);
}

代码示例来源:origin: babyfish-ct/babyfish

public AbstractEntryImpl(BaseEntry<K, V> baseEntry) throws NoEntryException {
  if (baseEntry == null) {
    throw new NoEntryException();
  }
  Arguments.mustBeInstanceOfValue(
      "baseEntry.getOwner()", 
      baseEntry.getOwner(), 
      AbstractBaseEntriesImpl.class);
  this.baseEntry = baseEntry;
}

代码示例来源:origin: babyfish-ct/babyfish

private void pathMustBeChildOfRoot(Path<?> attribute) {
  Arguments.mustBeInstanceOfValue("attribute.getModel()", attribute.getModel(), SingularAttribute.class);
  for (Path<?> parent = attribute.getParentPath(); parent != null; parent = parent.getParentPath()) {
    if (parent == this.root) {
      return;
    }
  }
  throw new IllegalArgumentException(pathMustBeChildOfRoot(this.getClass()));
}

代码示例来源:origin: babyfish-ct/babyfish

public Cause(ModificationEvent viewEvent) {
  Object viewSource = viewEvent.getSource();
  Arguments.mustBeInstanceOfValue("viewEvent.getSource()", viewSource, View.class);
  this.viewInfo = ((View)viewSource).viewInfo();
  this.viewEvent = Arguments.mustNotBeNull("viewEvent", viewEvent);
}

代码示例来源:origin: babyfish-ct/babyfish

FrozenLazyInitializerImpl(HibernateProxy owner) {
  ProxyObject proxyObject = (ProxyObject)owner;
  MethodHandler handler = proxyObject.getHandler();
  if (!(handler instanceof LazyInitializer)) {
    Arguments.mustBeInstanceOfValue(
        "((" +
        ProxyObject.class.getName() +
        ")owner).getHandler()", 
        handler, 
        LazyInitializer.class);
  }
  LazyInitializer lazyInitializer = owner.getHibernateLazyInitializer();
  if (lazyInitializer instanceof FrozenLazyInitializer) {
    throw new AssertionError("Internal bug");
  }
  this.owner = owner;
  this.lazyInitializer = lazyInitializer;
  this.initTransient();
  proxyObject.setHandler(this);
}

代码示例来源:origin: babyfish-ct/babyfish

public InPredicate(
    XCriteriaBuilder criteriaBuilder, 
    Expression<? extends T> expression) {
  super(criteriaBuilder);
  Arguments.mustNotBeNull("expression", expression);
  this.mustUnderSameCriteriaBuilder("expression", expression);
  this.expression = expression;
  this.values = new ArrayList<>();
  XEntityManagerFactory entityManagerFactory = criteriaBuilder.getEntityManagerFactory();
  Arguments.mustBeInstanceOfValue("entityManagerFactory", entityManagerFactory, EntityManagerFactoryConfigurable.class);
  this.maxPartitionSize = 
      ((EntityManagerFactoryConfigurable)entityManagerFactory)
      .getInPredicateMaxPartitionSize();
}

代码示例来源:origin: babyfish-ct/babyfish

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public <X, T, V extends T> XJoin<X, V> treat(Join<X, T> join, Class<V> type) {
  if (join instanceof MapJoin<?, ?, ?>) {
    return this.treat((MapJoin)join, type);
  }
  if (join instanceof ListJoin<?, ?>) {
    return this.treat((ListJoin<X, T>)join, type);
  }
  if (join instanceof SetJoin<?, ?>) {
    return this.treat((SetJoin<X, T>)join, type);
  }
  if (join instanceof CollectionJoin<?, ?>) {
    return this.treat((CollectionJoin<X, T>)join, type);
  }
  Arguments.mustBeInstanceOfValue("join", join, SingularAttributeJoin.class);
  return new TreatedSingularAttributeJoin<>((SingularAttributeJoin<X, T>)join, type);
}

代码示例来源:origin: babyfish-ct/babyfish

protected AbstractWrapperXCollection(
    AbstractWrapperXCollection<E> parent, 
    ViewInfo viewInfo) {
  Arguments.mustNotBeNull("parent", parent);
  Arguments.mustBeInstanceOfValue("this", this, View.class);
  Arguments.mustNotBeInstanceOfValue("this", this, Serializable.class);
  this.parent = parent;
  this.rootData = parent.rootData;
  this.viewInfo = viewInfo;
  XCollection<E> base = parent.getBase(true);
  if (base != null) {
    base = this.createBaseView(base, viewInfo);
    if (!(base instanceof View)) {
      throw new IllegalProgramException(CommonMessages.createBaseViewMustReturnView(this.getClass(), View.class));
    }
    this.setBase(base);
  }
}

代码示例来源:origin: babyfish-ct/babyfish

protected AbstractWrapperXMap(
    AbstractWrapperXMap<K, V> parent, ViewInfo viewInfo) {
  Arguments.mustNotBeNull("parent", parent);
  Arguments.mustBeInstanceOfValue("this", this, View.class);
  Arguments.mustNotBeInstanceOfValue("this", this, Serializable.class);
  this.parent = parent;
  this.rootData = parent.rootData;
  this.viewInfo = viewInfo;
  XMap<K, V> base = parent.getBase(true);
  if (base != null) {
    base = this.createBaseView(base, viewInfo);
    if (!(base instanceof View)) {
      throw new IllegalProgramException(
          CommonMessages.createBaseViewMustReturnView(this.getClass(), View.class)
      );
    }
    this.setBase(base);
  }
}

代码示例来源:origin: babyfish-ct/babyfish

@SuppressWarnings("unchecked")
public HibernateScalarLoader(ObjectModel objectModel, FieldHandler handler) {
  Arguments.mustNotBeNull("objectModel", objectModel);
  Arguments.mustBeInstanceOfValue("handler", handler, AbstractFieldInterceptor.class);
  this.defaultObjectModel = objectModel;
  AbstractFieldInterceptor abstractFieldInterceptor = (AbstractFieldInterceptor)handler;
  this.session = abstractFieldInterceptor.getSession();
  Set<String> uninitializedFields = abstractFieldInterceptor.getUninitializedFields();
  if (!Nulls.isNullOrEmpty(uninitializedFields)) {
    Map<String, ModelProperty> properties = this.defaultObjectModel.getModelClass().getProperties();
    for (String uninitializedField : uninitializedFields) {
      this.defaultObjectModel.unload(properties.get(uninitializedField).getId());
    }
  }
}

代码示例来源:origin: babyfish-ct/babyfish

@SuppressWarnings("unchecked")
protected final void replace(Object base) {
  Arguments.mustNotBeInstanceOfValue("this", this, View.class);
  Arguments.mustNotBeInstanceOfValue("base", base, View.class);
  Arguments.mustBeInstanceOfValue("base", base, XCollection.class);
  
  // Unnecessary but for optimization
  if (this instanceof ModificationAware) {
    MACollection<E> oldBase = (MACollection<E>)this.base;
    if (oldBase != null) {
      oldBase.removeElementListener(this.eventDispatcher());
    }
  }
  
  // Only need to change "root.base", because "this.base" will be 
  // refreshed automatically when "this.getBase()" is called later.
  this.getRootData().setBase((XCollection<E>)base);
}

代码示例来源:origin: babyfish-ct/babyfish

@SuppressWarnings("unchecked")
protected final void replace(Object base) {
  Arguments.mustNotBeInstanceOfValue("this", this, View.class);
  Arguments.mustNotBeInstanceOfValue("base", base, View.class);
  Arguments.mustBeInstanceOfValue("base", base, XMap.class);
  
  // Unnecessary but for optimization
  if (this instanceof ModificationAware) {
    MAMap<K, V> oldBase = (MAMap<K, V>)this.base;
    if (oldBase != null) {
      oldBase.removeMapElementListener(this.eventDispatcher());
    }
  }
  
  // Only need to change "root.base", because "this.base" will be 
  // refreshed automatically when "this.getBase()" is called later.
  this.getRootData().setBase((XMap<K, V>)base);
}

代码示例来源:origin: babyfish-ct/babyfish

Arguments.mustBeInstanceOfValue("primaryKey", primaryKey, Serializable.class);

相关文章