it.tidalwave.util.As类的使用及代码示例

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

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

As介绍

暂无

代码示例

代码示例来源:origin: it.tidalwave.bluemarine2/it-tidalwave-bluemarine2-model

/*******************************************************************************************************************
 *
 *
 *
 ******************************************************************************************************************/
@Nonnull // FIXME: this should be normally done by as()
private static SimpleComposite8 asSimpleComposite (final @Nonnull As object)
 {
  return (object instanceof SimpleComposite8) ? (SimpleComposite8)object : object.as(SimpleComposite8);
 }

代码示例来源:origin: it.tidalwave.thesefoolishthings/it-tidalwave-role

/*******************************************************************************************************************
 *
 * {@inheritDoc}
 *
 ******************************************************************************************************************/
@Override @Nonnull
public <T> Collection<T> asMany (final @Nonnull Class<T> roleType)
 {
  final Collection<T> result = asSupport.asMany(roleType);
  // The problem here is that we want only to add local roles in owner; but calling owner.as() will also
  // find again the global roles that were discovered by AsSupport.
  if (roleType.isAssignableFrom(owner.getClass()))
   {
    result.add(roleType.cast(owner));
   }
  if (owner instanceof As)
   {
    result.addAll(((As)owner).asMany(roleType));
   }
  return result;
 }

代码示例来源:origin: it.tidalwave.northernwind.rca/it-tidalwave-role-ui-javafx

when(asObjectWithoutUserActionProvider.as(eq(UserActionProvider.class))).thenThrow(new AsException(UserActionProvider.class));
when(asObjectWithoutUserActionProvider.asMany(eq(UserActionProvider.class))).thenReturn(new ArrayList<UserActionProvider>());
when(asObjectWithUserActionProvider.as(eq(UserActionProvider.class))).thenReturn(userActionProvider);
when(asObjectWithUserActionProvider.asMany(eq(UserActionProvider.class))).thenReturn(Arrays.asList(userActionProvider));

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-bluebill-observation-simple

public int compare (final @Nonnull As o1, final @Nonnull As o2)
  {
   return DISPLAYABLE_COMPARATOR.compare(o1.as(Displayable), o2.as(Displayable));
  }
};

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Override
public void setDisplayName (final @Nonnull String displayName)
 {
  SkosConceptUtils.setDisplayName(object.as(Entity.class), displayName);
 }

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Override
public void setDisplayName (final @Nonnull String displayName,
              final @Nonnull Locale locale)
 {
  SkosConceptUtils.setDisplayName(object.as(Entity.class), displayName, locale);
 }

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Override @Nonnull
public String getDisplayName (final @Nonnull Locale locale)
 {
  return SkosConceptUtils.getDisplayName(object.as(Entity.class), locale);
 }

代码示例来源:origin: it.tidalwave.thesefoolishthings/it-tidalwave-role

@Override
 public int compare (final @Nonnull As object1, final @Nonnull As object2)
  {
   return collator.compare(object1.as(Displayable).getDisplayName(), object2.as(Displayable).getDisplayName());
  }
}

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Override @Nonnull
public String getDisplayName()
 {
  return SkosConceptUtils.getDisplayName(object.as(Entity.class));
 }

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

@Override @Nonnull
 protected Set<Concept> doCompute()
  {
   // FIXME: implement as a query
   return object.as(Concept.class).getSkosNarrowers();
  }
};

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

@Override
 protected void process (final @Nonnull Set<String> auxStatements)
  {
   idMapByPlaceHolder.put("id", object.as(Entity.class).getQName());
   auxStatements.add(String.format("{ ?id owl:sameAs ?%s } UNION { ?%s owl:sameAs ?id }", entityName, entityName));
  }
};

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

@Override @Nonnull
 protected Set<Concept> doCompute()
  {
   // FIXME: implement as a query
   return object.as(Concept.class).getSkosBroaders();
  }
};

代码示例来源:origin: it.tidalwave.bluemarine2/it-tidalwave-bluemarine2-model

@Nonnull
 private static String displayName (final @Nonnull As object)
  {
   try
    {
     return object.as(Displayable).getDisplayName();
    }
   catch (AsException e)
    {
     return "???";
    }
  }
}

代码示例来源:origin: it.tidalwave.thesefoolishthings/it-tidalwave-role

@Nonnull
 public T run (final Throwable t)
  {
   if (owner instanceof As)
    {
     final T role = ((As)owner).as(roleType);
     if (role != null) // do check it for improper implementations or partial mocks
      {
       return role;
      }
    }
   return notFoundBehaviour.run(t);
  }
});

代码示例来源:origin: it.tidalwave.geo/it-tidalwave-geo

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Nonnull
public static Range on (final @Nonnull As as)
 {
  try
   {
    return new Range(as.as(Coordinate.class), 0);
   }
  catch (AsException e)
   {
    throw new IllegalArgumentException("" + as);
   }
 }

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-android-utilities

public void update (final @Nonnull TextView textView) 
  {
   getItem(index).as(TextViewRenderable).renderTo(textView);
  }                    
});

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
   *
   *
   ******************************************************************************************************************/
  @Override
  public void addSameAs (final @Nonnull As other)
   {
    final Thing unwrappedObject1 = Wrapper.unwrap(object.as(Thing.class));
    final Thing unwrappedObject2 = Wrapper.unwrap(other.as(Thing.class));
    unwrappedObject1.getOwlSameAs().add(unwrappedObject2);
//            ((Thing)geoNode).getOwlSameAs().add((Thing)entity); // FIXME: see note in Utils.findSameAs()
   }
 }

代码示例来源:origin: it.tidalwave.semantic/it-tidalwave-openrdf-elmo

/*******************************************************************************************************************
  *
  *
  ******************************************************************************************************************/
 private static void createBroaderNarrowerRelationship (final @Nonnull As broader, final @Nonnull As narrower)
  {
   final Concept unwrappedBroader = Wrapper.unwrap(broader.as(Concept.class));
   final Concept unwrapperNarrower = Wrapper.unwrap(narrower.as(Concept.class));
   unwrappedBroader.getSkosNarrowers().add(unwrapperNarrower);
   unwrapperNarrower.getSkosBroaders().add(unwrappedBroader); // FIXME: see note in Utils.findSameAs()
  }
}

代码示例来源:origin: it.tidalwave.bluebill.android/it-tidalwave-android-utilities

@Nonnull
 private View fixedView (final @Nonnegative int position,
             final @Nonnull View view)
  {
   if (view instanceof TextView)
    {
     final Object item = getItem(position);
     Displayable displayable = null;
     
     if (item instanceof Displayable)
      {
       displayable = (Displayable)item;
      }
     else if (item instanceof As)
      {
       displayable = ((As)item).as(Displayable.class);
      }
     ((TextView)view).setText((displayable != null) ? displayable.getDisplayName() : "???");
    }
   return view;
  }
}

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-android-utilities

@Nonnull
 private View fixedView (final @Nonnegative int position,
             final @Nonnull View view)
  {
   if (view instanceof TextView)
    {
     final Object item = getItem(position);
     Displayable displayable = null;
     
     if (item instanceof Displayable)
      {
       displayable = (Displayable)item;
      }
     else if (item instanceof As)
      {
       displayable = ((As)item).as(Displayable);
      }
     ((TextView)view).setText((displayable != null) ? displayable.getDisplayName() : "???");
    }
   return view;
  }
}

相关文章

微信公众号

最新文章

更多