public Action[] getActions() { return actions.toArray(new Action[actions.size()]); }
@Override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj == null) { out.writeNull(); } else { try { Field field = EnumSet.class.getDeclaredField("elementType"); field.setAccessible(true); Class type = (Class) field.get(obj); EnumSet enumSet = (EnumSet) obj; Object[] objects = enumSet.toArray(); out.writeObject(new EnumSetHandler(type, objects)); } catch (Throwable t) { throw new IOException(t); } } } }
public SwingTerminalFrame createSwingTerminal() { return new SwingTerminalFrame( title, initialTerminalSize, deviceConfiguration, fontConfiguration instanceof SwingTerminalFontConfiguration ? (SwingTerminalFontConfiguration)fontConfiguration : null, colorConfiguration, autoCloseTriggers.toArray(new TerminalEmulatorAutoCloseTrigger[autoCloseTriggers.size()])); }
@SuppressWarnings("unchecked") Object writeReplace() { SerializationProxy proxy = new SerializationProxy(); proxy.elements = toArray(new Enum[0]); proxy.elementType = elementClass; return proxy; } }
public AWTTerminalFrame createAWTTerminal() { return new AWTTerminalFrame( title, initialTerminalSize, deviceConfiguration, fontConfiguration, colorConfiguration, autoCloseTriggers.toArray(new TerminalEmulatorAutoCloseTrigger[autoCloseTriggers.size()])); }
private static CascadeAction[] mapCascadeActions(CascadeType[] types) { EnumSet<CascadeAction> actions = EnumSet.noneOf(CascadeAction.class); for (CascadeType type : types) { switch (type) { case ALL: actions.add(CascadeAction.SAVE); actions.add(CascadeAction.DELETE); case PERSIST: actions.add(CascadeAction.SAVE); break; case MERGE: actions.add(CascadeAction.SAVE); break; case REMOVE: actions.add(CascadeAction.DELETE); break; case REFRESH: break; } } return actions.toArray(new CascadeAction[actions.size()]); } }
@Override @SuppressWarnings("unchecked") public Object encode(final Object value, final MappedField optionalExtraInfo) { if (value == null) { return null; } final List values = new ArrayList(); final EnumSet s = (EnumSet) value; final Object[] array = s.toArray(); for (final Object anArray : array) { values.add(ec.encode(anArray)); } return values; } }
@Override public void write(DataOutput out) throws IOException { if (this.value == null) { out.writeInt(-1); WritableUtils.writeString(out, this.elementType.getName()); } else { Object[] array = this.value.toArray(); int length = array.length; out.writeInt(length); if (length == 0) { if (this.elementType == null) throw new UnsupportedOperationException( "Unable to serialize empty EnumSet with no element type provided."); WritableUtils.writeString(out, this.elementType.getName()); } for (int i = 0; i < length; i++) { ObjectWritable.writeObject(out, array[i], array[i].getClass(), conf); } } }
Set<RepositoryFilePermission> permissions = new HashSet<RepositoryFilePermission>( Arrays.asList( permissionEnumSet .toArray( new RepositoryFilePermission[permissionEnumSet.size()] ) ) ); boolean foundMaxPermission = false; if ( permissions.remove( RepositoryFilePermission.ALL ) ) {
@Override protected Map<String, FieldLoadSaveValidator<?>> createAttributeValidatorsMap() { EnumSet<LogLevel> logLevels = EnumSet.allOf( LogLevel.class ); LogLevel random = (LogLevel) logLevels.toArray()[new Random().nextInt( logLevels.size() )]; return toMap( "loglevel", new EnumLoadSaveValidator<LogLevel>( random ) ); } }
/** * Copies another {@code ScreenCharacter} * @param character screenCharacter to copy from */ public TextCharacter(TextCharacter character) { this(character.getCharacter(), character.getForegroundColor(), character.getBackgroundColor(), character.getModifiers().toArray(new SGR[character.getModifiers().size()])); }
private Configuration deleteOptionFromConfiguration( Configuration config, Option option ) { Configuration currentConf = config; if ( currentConf != null ) { EnumSet<Option> currentOptions = EnumSet.noneOf( Option.class ); currentOptions.addAll( currentConf.getOptions() ); if ( currentOptions.remove( option ) ) { if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "JsonReader.Debug.Configuration.Option.Delete", option ) ); } currentConf = Configuration.defaultConfiguration().addOptions( currentOptions.toArray( new Option[currentOptions.size()] ) ); } } if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "JsonReader.Debug.Configuration.Options", currentConf.getOptions() ) ); } return currentConf; }
FieldDeclaration newField = old.getType(0) .addField(declarator.getType(), declarator.getNameAsString(), declaration.getModifiers().toArray(new Modifier[]{})); if (oldMethod.get(name) == null) { MethodDeclaration newMethod = old.getType(0) .addMethod(name, declaration.getModifiers().toArray(new Modifier[]{}));
private Permissions(String name, int id, EnumSet<Resources> resourceTypes) { this.name = name; this.id = id; this.resourceTypes = resourceTypes.toArray(new Resource[resourceTypes.size()]); }
/** * Create a ScalarTypeEnum. */ public OrdinalEnum(Class enumType) { super(enumType, false, Types.INTEGER); this.enumArray = EnumSet.allOf(enumType).toArray(); }
private Permissions(String name, int id, EnumSet<Resources> resourceTypes) { this.name = name; this.id = id; this.resourceTypes = resourceTypes.toArray(new Resource[resourceTypes.size()]); }
Feature[] features() { return features.toArray(new Feature[features.size()]); }
public Flag[] getFlags() { return flags.toArray(new Flag[flags.size()]); }
public AffixSetting(AffixKey key, Setting<T> delegate, Function<String, Setting<T>> delegateFactory, AffixSetting... dependencies) { super(key, delegate.defaultValue, delegate.parser, delegate.properties.toArray(new Property[0])); this.key = key; this.delegateFactory = delegateFactory; this.dependencies = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(dependencies))); }
/** * Returns all of the card types from two lists of card types. Duplicates * are eliminated. * * @param a * @param b * @return */ public static CardType[] mergeTypes(CardType[] a, CardType[] b) { EnumSet<CardType> cardTypes = EnumSet.noneOf(CardType.class); cardTypes.addAll(Arrays.asList(a)); cardTypes.addAll(Arrays.asList(b)); return cardTypes.toArray(new CardType[0]); }